diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-02-27 23:34:23 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2012-02-27 23:34:23 -0500 |
commit | 73c4144faeea20c20ce7dfb977cd07077e82c0e3 (patch) | |
tree | a1acf8c889effa65866287c3cf56b72a52513505 /lb | |
parent | b4aae66a7c3ba3eec714ca6cc11cd9913b5cf2fd (diff) |
Fix 4 bugs in lb
1. Check if the command exists *and* is executable
2. Quote ${command} in case it contains whitespace, which would break
syntax in the test (though, because it uses Bash builtin "[[" instead
of the normal "/usr/bin/[", Bash *usually* recovers from this safely.
3. Go ahead and exit with an error if we print a fatal error message,
don't keep running.
4. Put "$@" in quotes; it preserves whitespace in the arguments (while
still keeping separate arguments separate).
Diffstat (limited to 'lb')
-rwxr-xr-x | lb | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -6,10 +6,11 @@ source /etc/libretools.conf command=$1; shift -[[ ! -f ~/l/libre${command} ]] && { +[[ ! -x ~/l/libre"${command}" ]] && { error "Command not found" + exit 1 } -~/l/libre${command} $@ +~/l/libre${command} "$@" exit $? |