Fix sbang for perl (#1802)

* Perform shebang fix for all files

* Fix sbang for perl scripts

Otherwise perl would look at the #! line and call sbang again, resulting
in an infinite loop.
This commit is contained in:
Eric
2016-09-22 09:43:47 +02:00
committed by Todd Gamblin
parent 98f9dd266f
commit 025b779a30
2 changed files with 13 additions and 7 deletions

View File

@@ -111,8 +111,12 @@ while read line && ((lines < 2)) ; do
done < "$script"
# Invoke any interpreter found, or raise an error if none was found.
if [ -n "$interpreter" ]; then
exec $interpreter "$@"
if [[ -n "$interpreter" ]]; then
if [[ "${interpreter##*/}" = "perl" ]]; then
exec $interpreter -x "$@"
else
exec $interpreter "$@"
fi
else
echo "error: sbang found no interpreter in $script"
exit 1