From 1d3af1714022f62ee2f0ddeda06b457848f4ac6b Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 2 Jul 2019 19:48:08 +0300 Subject: [PATCH] Enable ShellCheck rules Enabled ShellCheck rules: SC1087 SC2001 SC2004 SC2005 SC2006 SC2016 SC2028 SC2048 SC2066 (note that IFS already contains only a line feed) SC2116 SC2166 SC2181 SC2206 SC2207 SC2230 SC2236 Zcash: Only the changes that applied to the versions of the scripts we have. --- autogen.sh | 2 +- contrib/devtools/gen-manpages.sh | 6 +++--- share/genbuild.sh | 2 +- test/lint/commit-script-check.sh | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/autogen.sh b/autogen.sh index bd1d3d265..69a20dc46 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,7 +9,7 @@ export LC_ALL=C set -e srcdir="$(dirname $0)" cd "$srcdir" -if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="`which glibtoolize 2>/dev/null`"; then +if [ -z ${LIBTOOLIZE} ] && GLIBTOOLIZE="$(command -v glibtoolize)"; then LIBTOOLIZE="${GLIBTOOLIZE}" export LIBTOOLIZE fi diff --git a/contrib/devtools/gen-manpages.sh b/contrib/devtools/gen-manpages.sh index b6e9df8b8..b4d9a668b 100755 --- a/contrib/devtools/gen-manpages.sh +++ b/contrib/devtools/gen-manpages.sh @@ -12,9 +12,9 @@ ZCASHTX=${ZCASHTX:-$SRCDIR/zcash-tx} [ ! -x $ZCASHD ] && echo "$ZCASHD not found or not executable." && exit 1 # The autodetected version git tag can screw up manpage output a little bit -ZECVERSTR=$($ZCASHCLI --version | head -n1 | awk '{ print $NF }') -ZECVER=$(echo $ZECVERSTR | awk -F- '{ OFS="-"; NF--; print $0; }') -ZECCOMMIT=$(echo $ZECVERSTR | awk -F- '{ print $NF }') +read -r -a ZECVERSTR <<< "$($ZCASHCLI --version | head -n1 | awk '{ print $NF }')" +read -r -a ZECVER <<< "$(echo $ZECVERSTR | awk -F- '{ OFS="-"; NF--; print $0; }')" +read -r -a ZECCOMMIT <<< "$(echo $ZECVERSTR | awk -F- '{ print $NF }')" # Create a footer file with copyright content. # This gets autodetected fine for zcashd if --version-string is not set, diff --git a/share/genbuild.sh b/share/genbuild.sh index 307d0d62a..895ce3792 100755 --- a/share/genbuild.sh +++ b/share/genbuild.sh @@ -25,7 +25,7 @@ SUFFIX="" LAST_COMMIT_DATE="" if [ -e "$(which git 2>/dev/null)" -a "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]; then # clean 'dirty' status of touched files that haven't been modified - git diff >/dev/null 2>/dev/null + git diff >/dev/null 2>/dev/null # if latest commit is tagged and not dirty, then override using the tag name RAWDESC=$(git describe --abbrev=0 2>/dev/null) diff --git a/test/lint/commit-script-check.sh b/test/lint/commit-script-check.sh index 4267f9fa0..5603456e6 100755 --- a/test/lint/commit-script-check.sh +++ b/test/lint/commit-script-check.sh @@ -18,12 +18,12 @@ if test "x$1" = "x"; then fi RET=0 -PREV_BRANCH=`git name-rev --name-only HEAD` -PREV_HEAD=`git rev-parse HEAD` -for commit in `git rev-list --reverse $1`; do +PREV_BRANCH=$(git name-rev --name-only HEAD) +PREV_HEAD=$(git rev-parse HEAD) +for commit in $(git rev-list --reverse $1); do if git rev-list -n 1 --pretty="%s" $commit | grep -q "^scripted-diff:"; then git checkout --quiet $commit^ || exit - SCRIPT="`git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d'`" + SCRIPT="$(git rev-list --format=%b -n1 $commit | sed '/^-BEGIN VERIFY SCRIPT-$/,/^-END VERIFY SCRIPT-$/{//!b};d')" if test "x$SCRIPT" = "x"; then echo "Error: missing script for: $commit" echo "Failed"