diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-03-24 09:11:27 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-03-24 09:11:27 +1300 |
commit | 9d6199c5dc0911a5595e5f225ad909845ed8cc17 (patch) | |
tree | ba015cf824cbefeab8c2950700ed99669b3d0859 /bin | |
parent | Use builtin macros for filenames (diff) | |
download | dotfiles-9d6199c5dc0911a5595e5f225ad909845ed8cc17.tar.gz dotfiles-9d6199c5dc0911a5595e5f225ad909845ed8cc17.zip |
Change shb(1) to read stdin by default
This is clearer.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/shb | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -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 |