diff options
author | Eric <muffgaga@gmx.de> | 2016-09-22 09:43:47 +0200 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-09-22 00:43:47 -0700 |
commit | 025b779a30476dd2b6ba9851e4ef1d57812b97c7 (patch) | |
tree | 524b5b079dcc878214e70290b95d95f786210b34 /bin/sbang | |
parent | 98f9dd266fe53444c77bcb6b810dda788c1fa558 (diff) | |
download | spack-025b779a30476dd2b6ba9851e4ef1d57812b97c7.tar.gz spack-025b779a30476dd2b6ba9851e4ef1d57812b97c7.tar.bz2 spack-025b779a30476dd2b6ba9851e4ef1d57812b97c7.tar.xz spack-025b779a30476dd2b6ba9851e4ef1d57812b97c7.zip |
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.
Diffstat (limited to 'bin/sbang')
-rwxr-xr-x | bin/sbang | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |