From c63f7e9f64ee394b3311edb7f36f56fd786d145a Mon Sep 17 00:00:00 2001 From: a1346054 Date: Tue, 31 Aug 2021 17:01:47 +0000 Subject: shell scripts: fix shellcheck warnings --- tests/stress_tests/pingpong.bash | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'tests/stress_tests/pingpong.bash') diff --git a/tests/stress_tests/pingpong.bash b/tests/stress_tests/pingpong.bash index 218b6e8..4b8346e 100755 --- a/tests/stress_tests/pingpong.bash +++ b/tests/stress_tests/pingpong.bash @@ -13,7 +13,7 @@ renice 19 $$ cd "$(dirname "$0")" MD5="$PWD/linux-3.0.md5sums" -MYNAME=$(basename $0) +MYNAME=$(basename "$0") source ../fuse-unmount.bash # Setup @@ -22,48 +22,48 @@ cd /tmp PING=$(mktemp -d ping.XXX) PONG=$(mktemp -d pong.XXX) -mkdir $PING.mnt $PONG.mnt +mkdir "$PING.mnt" "$PONG.mnt" # Cleanup trap # Note: gocryptfs may have already umounted itself because bash relays SIGINT # Just ignore unmount errors. trap "set +e ; cd /tmp; fuse-unmount -z $PING.mnt ; fuse-unmount -z $PONG.mnt ; rm -rf $PING $PONG $PING.mnt $PONG.mnt" EXIT -gocryptfs -q -init -extpass="echo test" -scryptn=10 $PING -gocryptfs -q -init -extpass="echo test" -scryptn=10 $PONG +gocryptfs -q -init -extpass="echo test" -scryptn=10 "$PING" +gocryptfs -q -init -extpass="echo test" -scryptn=10 "$PONG" -gocryptfs -q -extpass="echo test" -nosyslog $PING $PING.mnt -gocryptfs -q -extpass="echo test" -nosyslog $PONG $PONG.mnt +gocryptfs -q -extpass="echo test" -nosyslog "$PING" "$PING.mnt" +gocryptfs -q -extpass="echo test" -nosyslog "$PONG" "$PONG.mnt" echo "Initial extract" -tar xf /tmp/linux-3.0.tar.gz -C $PING.mnt +tar xf /tmp/linux-3.0.tar.gz -C "$PING.mnt" -function move_and_md5 { - if [ $MYNAME = pingpong-rsync.bash ]; then +move_and_md5() { + if [ "$MYNAME" = "pingpong-rsync.bash" ]; then echo -n "rsync " - rsync -a --remove-source-files $1 $2 - find $1 -type d -delete + rsync -a --remove-source-files "$1" "$2" + find "$1" -type d -delete else echo -n "mv " - mv $1 $2 + mv "$1" "$2" fi - if [ -e $1 ]; then + if [ -e "$1" ]; then echo "error: source directory $1 was not removed" exit 1 fi - cd $2 + cd "$2" echo -n "md5 " - md5sum --status -c $MD5 + md5sum --status -c "$MD5" cd .. } N=1 while true; do echo -n "$N: " - move_and_md5 $PING.mnt/linux-3.0 $PONG.mnt - move_and_md5 $PONG.mnt/linux-3.0 $PING.mnt + move_and_md5 "$PING.mnt/linux-3.0" "$PONG.mnt" + move_and_md5 "$PONG.mnt/linux-3.0" "$PING.mnt" date +%H:%M:%S - let N=$N+1 + N=$((N+1)) done wait -- cgit v1.2.3