2015-06-13 01:03:31 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
if [ $# = 0 -o "$1" = "-h" ]; then
|
|
|
|
echo 'usage: termux-fix-shebang <files>'
|
|
|
|
echo 'Rewrite shebangs in specified files for running under Termux,'
|
2019-09-19 22:57:17 +02:00
|
|
|
echo 'which is done by rewriting #!*/bin/binary to #!@TERMUX_PREFIX@/bin/binary.'
|
2015-06-13 01:03:31 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-04-02 14:45:35 +02:00
|
|
|
for file in "$@"; do
|
2019-09-19 22:57:17 +02:00
|
|
|
sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#\!@TERMUX_PREFIX@/bin/\2@" "$(realpath "${file}")"
|
2015-09-09 00:36:35 +02:00
|
|
|
done
|