Skip to content

Commit

Permalink
Clean up lint
Browse files Browse the repository at this point in the history
Fix issues identified by shellcheck
<http://www.shellcheck.net/about.html>:
* Unquoted expansions (not all caused shellcheck to emit a warning)
  <https://github.com/koalaman/shellcheck/wiki/SC2086> and
  <https://github.com/koalaman/shellcheck/wiki/SC2046>
* Use $(...) instead of deprecated `...`
  <https://github.com/koalaman/shellcheck/wiki/SC2006>

Merge one-use variable dir from the else clause into the expansion in
which it's used.
  • Loading branch information
Aidan Gauland committed Nov 8, 2014
1 parent 9f28e8a commit 884c804
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bin/gcc-rtags-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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?

0 comments on commit 884c804

Please sign in to comment.