Fix shellcheck warnings/errors in shell scripts.

This commit is contained in:
Geoff Greer 2016-02-15 18:34:48 -08:00
parent c0f73f8b71
commit 8c3d307a59
4 changed files with 16 additions and 4 deletions

View file

@ -1,3 +1,5 @@
#!/bin/bash
_ag() {
local lngopt shtopt split=false
local cur prev
@ -129,4 +131,7 @@ _ag() {
return 0;;
esac
} &&
# shellcheck disable=SC2086
# shellcheck disable=SC2154,SC2086
complete -F _ag ${nospace} ag

View file

@ -1,6 +1,6 @@
#!/bin/sh
cd `dirname $0`
cd "$(dirname "$0")" || exit 1
AC_SEARCH_OPTS=""
# For those of us with pkg-config and other tools in /usr/local
@ -13,6 +13,7 @@ then
AC_SEARCH_OPTS="-I /usr/local/share/aclocal"
fi
# shellcheck disable=2086
aclocal $AC_SEARCH_OPTS && \
autoconf && \
autoheader && \

View file

@ -22,18 +22,21 @@ then
exit 1
fi
SOURCE_FILES=`git ls-files src/`
SOURCE_FILES=$(git ls-files src/)
if [ "$1" == "reformat" ]
then
echo "Reformatting source files"
# shellcheck disable=2086
echo $CLANG_FORMAT -style=file -i $SOURCE_FILES
# shellcheck disable=2086
$CLANG_FORMAT -style=file -i $SOURCE_FILES
exit 0
elif [ "$1" == "test" ]
then
RESULT=`$CLANG_FORMAT -style=file -output-replacements-xml $SOURCE_FILES | grep -c '<replacement '`
if [ $RESULT -eq 0 ]
# shellcheck disable=2086
RESULT=$($CLANG_FORMAT -style=file -output-replacements-xml $SOURCE_FILES | grep -c '<replacement ')
if [ "$RESULT" -eq 0 ]
then
echo "code is formatted correctly :)"
exit 0

View file

@ -1,4 +1,7 @@
#!/bin/bash
# All cram tests should use this. Make sure that "ag" runs the version
# of ag we just built, and make the output really simple.
# shellcheck disable=2139
alias ag="$TESTDIR/../ag --nocolor --workers=1 --parallel"