termux-tools: fix termux-fix-shebang script (#888)
authorLeonid Plyushch <leonid.plyushch@gmail.com>
Sun, 2 Apr 2017 12:45:35 +0000 (15:45 +0300)
committerFredrik Fornwall <fredrik@fornwall.net>
Sun, 2 Apr 2017 12:45:35 +0000 (14:45 +0200)
packages/termux-tools/termux-fix-shebang

index 1ac56c2..84bbca4 100755 (executable)
@@ -7,7 +7,6 @@ if [ $# = 0 -o "$1" = "-h" ]; then
        exit 1
 fi
 
-for file in $@; do
-       # Do realpath to avoid breaking symlinks (modify original file):
-       sed -i -E "1 s@^#\!(.*)/bin/(.*)@#\!/data/data/com.termux/files/usr/bin/\2@" `realpath $@`
+for file in "$@"; do
+       sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#\!/data/data/com.termux/files/usr/bin/\2@" "$(realpath "${file}")"
 done