From 884c8046b4a4bd576f7f100d7beb3852d6ab1da8 Mon Sep 17 00:00:00 2001 From: Aidan Gauland Date: Sat, 8 Nov 2014 22:56:43 +1300 Subject: [PATCH] Clean up lint Fix issues identified by shellcheck : * Unquoted expansions (not all caused shellcheck to emit a warning) and * Use $(...) instead of deprecated `...` Merge one-use variable dir from the else clause into the expansion in which it's used. --- bin/gcc-rtags-wrapper.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bin/gcc-rtags-wrapper.sh b/bin/gcc-rtags-wrapper.sh index ca61ce224..8596d7924 100755 --- a/bin/gcc-rtags-wrapper.sh +++ b/bin/gcc-rtags-wrapper.sh @@ -4,16 +4,16 @@ if [ "$RTAGS_GCC_WRAPPER" = "1" ]; then echo 1>&2 "Recursive invocation of gcc-rtags-wrapper.sh detected" exit 1 fi -rc=`which rc` -for i in `which -a "\`basename $0\`"`; do - filename=$(basename $(readlink "$i")) +rc=$(which rc) +for i in $(which -a "$(basename "$0")"); do + filename=$(basename "$(readlink "$i")") if [ "$filename" != "gcc-rtags-wrapper.sh" ] && [ -z "$PLAST" -o "$filename" != "plastc" ]; then [ -n "$RTAGS_SERVER_FILE" ] && RTAGS_ARGS="$RTAGS_ARGS -n$RTAGS_SERVER_FILE" [ -n "$RTAGS_PROJECT" ] && RTAGS_ARGS="$RTAGS_ARGS --project-root=$RTAGS_PROJECT" [ -z "$RTAGS_COMPILE_TIMEOUT" ] && RTAGS_COMPILE_TIMEOUT=3000 if [ -z "$RTAGS_DISABLED" ] && [ -x "$rc" ]; then - $rc --timeout=$RTAGS_COMPILE_TIMEOUT $RTAGS_ARGS --silent --compile "$i" "$@" & + $rc --timeout="$RTAGS_COMPILE_TIMEOUT" "$RTAGS_ARGS" --silent --compile "$i" "$@" & disown &>/dev/null # rc might be finished by now and if so disown will yell at us fi [ "$RTAGS_RMAKE" ] && exit 0 @@ -22,8 +22,7 @@ for i in `which -a "\`basename $0\`"`; do "$i" "$@" exit $? else - dir=`dirname $i` - PATH=`echo $PATH | sed -e "s,$dir/*:*,,g"` + PATH="$(echo "$PATH" | sed -e "s,$(dirname "$i")/*:*,,g")" fi done exit 1 ### no compiler found?