Add CLI argument check in shebang-patcher

This commit is contained in:
coolneng 2022-12-27 11:02:25 +01:00
parent d927b1d645
commit d5c755be58
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,12 @@
#!/bin/sh #!/bin/sh
usage() {
echo "Usage: shebang-patcher <script>"
exit 1
}
if [ $# != 1 ]; then
usage
fi
sed "s/#!\/bin\/bash/#!\/usr\/bin\/env bash/" -i "$1" sed "s/#!\/bin\/bash/#!\/usr\/bin\/env bash/" -i "$1"