summaryrefslogtreecommitdiff
path: root/bin/sbang
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2016-08-23 09:45:46 -0400
committerErik Schnetter <schnetter@gmail.com>2016-08-23 09:45:46 -0400
commit64d3f87e605f596c149152bbab98ad3cfc89d549 (patch)
tree8b767ef2943afafdd6b9932fba2b509d4fe344b7 /bin/sbang
parente43eaad5570009622bf0b19b2a9df2f7e70f8f3e (diff)
parente81f3daa2836c4eb8a7d4e6d0f2cfc6b65875612 (diff)
downloadspack-64d3f87e605f596c149152bbab98ad3cfc89d549.tar.gz
spack-64d3f87e605f596c149152bbab98ad3cfc89d549.tar.bz2
spack-64d3f87e605f596c149152bbab98ad3cfc89d549.tar.xz
spack-64d3f87e605f596c149152bbab98ad3cfc89d549.zip
Merge branch 'develop' into eschnett/sympol
Diffstat (limited to 'bin/sbang')
-rwxr-xr-xbin/sbang11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/sbang b/bin/sbang
index f6b6d35e8a..1ea5f06592 100755
--- a/bin/sbang
+++ b/bin/sbang
@@ -79,6 +79,15 @@
# Obviously, for this to work, `sbang` needs to have a short enough
# path that *it* will run without hitting OS limits.
#
+# For Lua, scripts the second line can't start with #!, as # is not
+# the comment character in lua (even though lua ignores #! on the
+# *first* line of a script). So, instrument a lua script like this,
+# using -- instead of # on the second line:
+#
+# 1 #!/bin/bash /path/to/sbang
+# 2 --!/long/path/to/lua with arguments
+# 3
+# 4 print "success!"
#
# How it works
# -----------------------------
@@ -95,6 +104,8 @@ lines=0
while read line && ((lines < 2)) ; do
if [[ "$line" = '#!'* ]]; then
interpreter="${line#\#!}"
+ elif [[ "$line" = '--!'*lua* ]]; then
+ interpreter="${line#--!}"
fi
lines=$((lines+1))
done < "$script"