From 5b7fcab766cfaa024afd5e1a3fc34dd88da559b2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 5 Apr 2018 14:41:19 +0930 Subject: [PATCH] tools: fix shellcheck errors. Not sure how this got through Travis. Signed-off-by: Rusty Russell --- tools/check-markdown.sh | 5 ++--- tools/check-spelling.sh | 3 +-- tools/update-mocks.sh | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/check-markdown.sh b/tools/check-markdown.sh index 257239bfa..5f3825070 100755 --- a/tools/check-markdown.sh +++ b/tools/check-markdown.sh @@ -1,8 +1,7 @@ #!/bin/bash -diff -u <(egrep 'sudo apt-get install .*git' README.md) \ - <(egrep 'sudo apt-get install .*git' doc/INSTALL.md) -if [[ $? != 0 ]]; then +if ! diff -u <(grep -E 'sudo apt-get install .*git' README.md) \ + <(grep -E 'sudo apt-get install .*git' doc/INSTALL.md); then echo "Dependencies listed in README.md are not identical to those listed in doc/INSTALL.md (see above). Please fix." exit 1 fi diff --git a/tools/check-spelling.sh b/tools/check-spelling.sh index e258897bc..c80669ca6 100755 --- a/tools/check-spelling.sh +++ b/tools/check-spelling.sh @@ -1,7 +1,6 @@ #!/bin/bash -git --no-pager grep -nHiE 'l[ightn]{6}g|l[ightn]{8}g|ilghtning|lgihtning|lihgtning|ligthning|lighnting|lightinng|lightnnig|lightnign' -- . ':!tools/check-spelling.sh' -if [[ $? == 0 ]]; then +if git --no-pager grep -nHiE 'l[ightn]{6}g|l[ightn]{8}g|ilghtning|lgihtning|lihgtning|ligthning|lighnting|lightinng|lightnnig|lightnign' -- . ':!tools/check-spelling.sh'; then echo "Identified a likely misspelling of the word \"lightning\" (see above). Please fix." echo "Is this warning incorrect? Please teach tools/check-spelling.sh about the exciting new word." exit 1 diff --git a/tools/update-mocks.sh b/tools/update-mocks.sh index 6ad1949eb..337bfdadf 100755 --- a/tools/update-mocks.sh +++ b/tools/update-mocks.sh @@ -9,8 +9,8 @@ FILE="$1" BASE=/tmp/mocktmp.$$.$(echo "$@" | tr / _) trap 'mv $BASE.old $FILE; rm -f $BASE.*' EXIT -START=$(fgrep -n '/* AUTOGENERATED MOCKS START */' "$FILE" | cut -d: -f1) -END=$(fgrep -n '/* AUTOGENERATED MOCKS END */' "$FILE" | cut -d: -f1) +START=$(grep -F -n '/* AUTOGENERATED MOCKS START */' "$FILE" | cut -d: -f1) +END=$(grep -F -n '/* AUTOGENERATED MOCKS END */' "$FILE" | cut -d: -f1) if [ -n "$START" ]; then mv "$FILE" "${BASE}.old" @@ -21,7 +21,7 @@ if [ -n "$START" ]; then if ! make "${FILE/%.c/}" 2> "${BASE}.err" >/dev/null; then tools/mockup.sh < "${BASE}.err" >> "${BASE}.stubs" # If there are no link errors, maybe compile fail for other reason? - if ! fgrep -q 'Generated stub for' "${BASE}.stubs"; then + if ! grep -F -q 'Generated stub for' "${BASE}.stubs"; then cat "${BASE}.err" exit 1 fi