Initial push
[termux-packages] / packages / termux-tools / termux-fix-shebang
diff --git a/packages/termux-tools/termux-fix-shebang b/packages/termux-tools/termux-fix-shebang
new file mode 100755 (executable)
index 0000000..cb8bc49
--- /dev/null
@@ -0,0 +1,10 @@
+#!/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
+
+sed -i -E "s@^#\!(.*)/bin/(.*)@#\!@TERMUX_PREFIX@/bin/\2@" $@