From 73c4144faeea20c20ce7dfb977cd07077e82c0e3 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 27 Feb 2012 23:34:23 -0500 Subject: 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). --- lb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lb b/lb index d4bd908..85fb4df 100755 --- a/lb +++ b/lb @@ -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 $? -- cgit v1.2.3