termux-packages/packages/termux-tools/termux-fix-shebang

13 lines
378 B
Bash
Executable File

#!/bin/sh
if [ $# = 0 -o "$1" = "-h" ]; then
echo 'usage: termux-fix-shebang <files>'
echo 'Rewrite shebangs in specified files for running under Termux,'
echo 'which is done by rewriting #!*/bin/binary to #!$PREFIX/bin/binary.'
exit 1
fi
for file in "$@"; do
sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#\!/data/data/com.termux/files/usr/bin/\2@" "$(realpath "${file}")"
done