Format shell scripts with shfmt.

All changes in this patch were performed automatically with `shfmt` with
configuration flags specified in `.pre-commit-config.yaml`.

In addition to fixing whitespace the roundtrip through shfmt's AST also
transforms command substitutions

    `cmd`
    # becomes
    $(cmd)

and some redirects

    >&2 echo "msg"
    # becomes
    echo >&2 "msg"
This commit is contained in:
Benjamin Bannier 2021-11-24 22:48:46 +01:00
parent e0b4659488
commit 1f388e3f40
34 changed files with 369 additions and 379 deletions

View file

@ -3,14 +3,14 @@
# Helper script for creating new external testing repos. See the
# README for details.
cwd=`pwd`
cwd=$(pwd)
if [ -z "$1" ]; then
echo "usage: $0 <name> [<dst-repo-url>]"
exit 1
fi
name=`pwd`/$1
name=$(pwd)/$1
repo=$2
if [ -e $name ]; then
@ -29,10 +29,10 @@ done
ln -s ../subdir-btest.cfg ./btest.cfg
cp $cwd/`dirname $0`/skel/test.skeleton tests
cp $cwd/`dirname $0`/skel/traces.cfg .
cp $cwd/`dirname $0`/skel/Makefile .
cp $cwd/`dirname $0`/skel/.gitignore .
cp $cwd/$(dirname $0)/skel/test.skeleton tests
cp $cwd/$(dirname $0)/skel/traces.cfg .
cp $cwd/$(dirname $0)/skel/Makefile .
cp $cwd/$(dirname $0)/skel/.gitignore .
git add * .gitignore

View file

@ -16,12 +16,12 @@ else
rm -f $diag
fi
rc=0;
rc=0
files_cwd=`ls $@`
files_baseline=`cd $TEST_BASELINE && ls $@`
files_cwd=$(ls $@)
files_baseline=$(cd $TEST_BASELINE && ls $@)
for i in `echo $files_cwd $files_baseline | sort | uniq`; do
for i in $(echo $files_cwd $files_baseline | sort | uniq); do
if [[ "$i" != "loaded_scripts.log" && "$i" != "prof.log" && "$i" != "debug.log" && "$i" != "stats.log" && "$i" != broker_*.log ]]; then
if [[ "$i" == "reporter.log" ]]; then
@ -33,11 +33,11 @@ for i in `echo $files_cwd $files_baseline | sort | uniq`; do
fi
if ! btest-diff $i; then
echo "" >>$diag
echo "#### btest-diff $i" >>$diag
echo "" >>$diag
cat $diag.tmp >>$diag
rc=1
echo "" >>$diag
echo "#### btest-diff $i" >>$diag
echo "" >>$diag
cat $diag.tmp >>$diag
rc=1
fi
fi
done

View file

@ -3,6 +3,6 @@
# Returns a list of git repositories found in subdirs of the
# current directory.
for i in `find . -type d`; do
for i in $(find . -type d); do
test -e $i/.git && echo $i
done

View file

@ -5,7 +5,7 @@
# traces.cfg must consist of lines of the form "<url> [<http-user>[:<http-password>]]"
if [ "$1" == "" ]; then
echo "usage: `basename $0` <traces-directory>"
echo "usage: $(basename $0) <traces-directory>"
exit 1
fi
@ -18,7 +18,7 @@ cfg=traces.cfg
for p in .proxy ../.proxy; do
if [ -e $p ]; then
proxy=`cat $p | head -1 | awk '{print $1}'`
proxy=$(cat $p | head -1 | awk '{print $1}')
echo Using proxy $proxy ...
proxy="ALL_PROXY=$proxy"
break
@ -37,16 +37,16 @@ cat $cfg | while read line; do
continue
fi
url=`echo $line | awk '{print $1}'`
auth=`echo $line | awk '{print $2}'`
url=$(echo $line | awk '{print $1}')
auth=$(echo $line | awk '{print $2}')
file=$1/`echo $url | sed 's#^.*/##g'`
file=$1/$(echo $url | sed 's#^.*/##g')
fp=$file.md5sum
if [ "$auth" != "" ]; then
auth="-u $auth"
# Hide the hostname and directory names in output messages
safe_url=`echo $url | sed 's#/[A-Za-z].*/#/[hidden]/#'`
safe_url=$(echo $url | sed 's#/[A-Za-z].*/#/[hidden]/#')
else
safe_url=$url
fi
@ -66,7 +66,7 @@ cat $cfg | while read line; do
download=1
fi
else
download=1
download=1
fi
if [ "$download" = "1" ]; then
@ -77,9 +77,9 @@ cat $cfg | while read line; do
}
echo
mv $fp.tmp $fp
#else
# echo "`basename $file` already available."
fi
#else
# echo "`basename $file` already available."
fi
rm -f $fp.tmp