aboutsummaryrefslogtreecommitdiff
path: root/bin/shb
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-03-24 09:11:27 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-03-24 09:11:27 +1300
commit9d6199c5dc0911a5595e5f225ad909845ed8cc17 (patch)
treeba015cf824cbefeab8c2950700ed99669b3d0859 /bin/shb
parentUse builtin macros for filenames (diff)
downloaddotfiles-9d6199c5dc0911a5595e5f225ad909845ed8cc17.tar.gz
dotfiles-9d6199c5dc0911a5595e5f225ad909845ed8cc17.zip
Change shb(1) to read stdin by default
This is clearer.
Diffstat (limited to 'bin/shb')
-rwxr-xr-xbin/shb13
1 files changed, 6 insertions, 7 deletions
diff --git a/bin/shb b/bin/shb
index 49894b0f..72ac818b 100755
--- a/bin/shb
+++ b/bin/shb
@@ -3,15 +3,14 @@
self=shb
# Need at least two arguments
-if [ "$#" -lt 2 ] ; then
- printf >&2 '%s: Need input file and command\n' "$self"
+if [ "$#" -lt 1 ] ; then
+ printf >&2 '%s: Need interpreter command\n' "$self"
exit 1
fi
-# First argument is the script (might be - for stdin), second argument is the
-# name of the interpreter
-scr=$1 intn=$2
-shift 2
+# First argument is the name of the interpreter
+intn=$1
+shift
# Try and find the path to the interpreter command, bail out if we can't
if ! intp=$(command -v "$intn" 2>/dev/null) ; then
@@ -25,4 +24,4 @@ set -- "$intp" "$@"
printf '#!%s\n' "$*"
# Emit the rest of the input
-cat -- "$scr"
+cat