Replace backticks in shell scripts with S()

This commit is contained in:
Andrew Wood
2023-07-22 20:20:15 +01:00
parent 101294195b
commit a24342a072
27 changed files with 107 additions and 107 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
#
# Check that data can be just passed straight through.
VALUE=`echo TESTING | $PROG 2>/dev/null` || exit 1
VALUE=$(echo TESTING | $PROG 2>/dev/null) || exit 1
test "$VALUE" = "TESTING"
# EOF
+1 -1
View File
@@ -6,7 +6,7 @@ sleep 1 | $PROG -f -i 0.1 >/dev/null 2>$TMP1
# There should be more than 6 lines of output.
#
NUM=`tr '\r' '\n' < $TMP1 | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | wc -l | tr -d ' ')
test $NUM -gt 6
# EOF
+2 -2
View File
@@ -4,9 +4,9 @@
# Transfer 102 bytes at 100 bytes/sec. It should take at least 1 second.
#
START=`date +%S`
START=$(date +%S)
dd if=/dev/zero bs=102 count=1 2>/dev/null | $PROG -L 100 2>/dev/null | cat >/dev/null
END=`date +%S`
END=$(date +%S)
test $START -ne $END
+1 -1
View File
@@ -7,7 +7,7 @@ dd if=/dev/zero bs=100 count=1 2>/dev/null \
# There should be more than 2 different lines of output.
#
NUM=`tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' ')
test $NUM -gt 2
# EOF
+1 -1
View File
@@ -8,7 +8,7 @@
# Count the number of different timer values; it should be >1.
#
NUM=`sort < $TMP1 | uniq -u | wc -l | tr -d ' '`
NUM=$(sort < $TMP1 | uniq -u | wc -l | tr -d ' ')
test $NUM -gt 1
# EOF
+1 -1
View File
@@ -7,7 +7,7 @@ dd if=/dev/zero bs=100 count=1 2>/dev/null \
# Count the number of different ETA values there have been.
#
NUM=`tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
# 3 or less - not OK, since it should have taken 4 seconds.
#
+1 -1
View File
@@ -7,7 +7,7 @@ dd if=/dev/zero bs=100 count=1 2>/dev/null \
# Count the number of different ETA values there have been.
#
NUM=`tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ' | sed '/^$/d' | sort | uniq | wc -l | tr -d ' ')
# There should be at least 1 line of output.
#
+1 -1
View File
@@ -11,7 +11,7 @@
# Count the number of different rates output.
#
NUM=`tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | sort | uniq -u | wc -l | tr -d ' ')
# There should be more than 2 different rates counted (around 100 bytes/sec
# for the each block, 0 bytes/sec for the gap in the middle, and around 50
+1 -1
View File
@@ -4,7 +4,7 @@
dd if=/dev/zero bs=100 count=1 2>/dev/null \
| LANG=C $PROG -f -b >/dev/null 2>$TMP1
NUM=`tr '\r' '\n' < $TMP1 | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | tr -d ' ')
test "$NUM" = "100B"
# EOF
+3 -3
View File
@@ -11,8 +11,8 @@ dd if=/dev/zero bs=100 count=1 2>/dev/null \
# The number of output lines should be >8 and <13, and the final percentage
# should be 100.
#
test `wc -l < $TMP1` -gt 8
test `wc -l < $TMP1` -lt 13
test `sed -n '$p' < $TMP1` -eq 100
test $(wc -l < $TMP1) -gt 8
test $(wc -l < $TMP1) -lt 13
test $(sed -n '$p' < $TMP1) -eq 100
# EOF
+2 -2
View File
@@ -4,7 +4,7 @@
# We nead GNU head. On some platforms it is named ghead instead of head.
HEAD=head
for p in `echo $PATH | tr ':' '\n'`
for p in $(echo $PATH | tr ':' '\n')
do
if test -x $p/ghead
then
@@ -17,7 +17,7 @@ done
COUNT1=100000000
#COUNT2=`$PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | wc -c | tr -d ' '`
# Remove \n to fix the test on AIX
COUNT2=`$PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | tr -d '\n' | wc -c | tr -d ' '`
COUNT2=$($PROG -B 100000 -q /dev/zero | $HEAD -c $COUNT1 | tr -d '\n' | wc -c | tr -d ' ')
#echo "[$COUNT1] [$COUNT2]"
+2 -2
View File
@@ -11,12 +11,12 @@ set -e
# generate some data
dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null
CKSUM1=`cksum $TMP1 | awk '{print $1}'`
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
# read through pv and test afterwards
$PROG -B 100000 -q $TMP1 > $TMP2
CKSUM2=`cksum $TMP2 | awk '{print $1}'`
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
test "x$CKSUM1" = "x$CKSUM2"
+1 -1
View File
@@ -14,7 +14,7 @@
# Count the number of rates output that are below 80.
#
NUM=`tr '\r' '\n' < $TMP1 | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' '`
NUM=$(tr '\r' '\n' < $TMP1 | tr -dc '0-9.\n' | sed '/^$/d' | awk '$1<80{print}' | wc -l | tr -d ' ')
# Nearly all of the output rates should be above 80 since the average rate
# will always be around 100 bytes per second, except for pauses.
+1 -1
View File
@@ -16,7 +16,7 @@
# Count how many different line lengths we've seen.
#
NUM=`tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l`
NUM=$(tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
# There should only be one length (not counting 0).
#
+1 -1
View File
@@ -16,7 +16,7 @@
# Count how many different line lengths we've seen.
#
NUM=`tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l`
NUM=$(tr '\r' '\n' < $TMP1 | awk '{x=length($0);if(x>0)print length($0)}' | sort | uniq | wc -l)
# There should only be one length (not counting 0).
#
+3 -3
View File
@@ -11,7 +11,7 @@ set -e
# generate some data
dd if=/dev/urandom of=$TMP1 bs=1024 count=10240 2>/dev/null
CKSUM1=`cksum $TMP1 | awk '{print $1}'`
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
# read through pv and test afterwards
(
@@ -26,7 +26,7 @@ sleep 1
dd if=$TMP1 bs=1024 skip=2048
) 2>/dev/null | $PROG -q -L 2M | cat > $TMP2
CKSUM2=`cksum $TMP2 | awk '{print $1}'`
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
test "x$CKSUM1" = "x$CKSUM2"
@@ -43,7 +43,7 @@ sleep 1
dd if=$TMP1 bs=1024 skip=2048
) 2>/dev/null | $PROG -q -L 2M > $TMP2
CKSUM2=`cksum $TMP2 | awk '{print $1}'`
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
test "x$CKSUM1" = "x$CKSUM2"
+4 -4
View File
@@ -12,9 +12,9 @@ dd if=/dev/zero bs=100 count=1 2>/dev/null \
# different elapsed times should be at least 7. The last percentage should
# be 100.
#
test `wc -l < $TMP1` -gt 8
test `wc -l < $TMP1` -lt 13
test `tr , . < "$TMP1" | awk '{print int(10*$1)}' | sort -n | uniq | wc -l` -gt 7
test `sed -n '$p' < $TMP1 | awk '{print $2}'` -eq 100
test $(wc -l < $TMP1) -gt 8
test $(wc -l < $TMP1) -lt 13
test $(tr , . < "$TMP1" | awk '{print int(10*$1)}' | sort -n | uniq | wc -l) -gt 7
test $(sed -n '$p' < $TMP1 | awk '{print $2}') -eq 100
# EOF
+3 -3
View File
@@ -12,8 +12,8 @@ dd if=/dev/zero bs=500 count=1 2>/dev/null \
# The number of output lines should be >8 and <13, and the final byte count
# should be 500.
#
test `wc -l < $TMP1` -gt 8
test `wc -l < $TMP1` -lt 13
test `sed -n '$p' < $TMP1` -eq 500
test $(wc -l < $TMP1) -gt 8
test $(wc -l < $TMP1) -lt 13
test $(sed -n '$p' < $TMP1) -eq 500
# EOF
+3 -3
View File
@@ -18,15 +18,15 @@ dd if=/dev/zero of=$TMP1 bs=1024 count=10240 2>/dev/null
(
sleep 1
$PROG -R `cat $TMP4` -a
$PROG -R $(cat $TMP4) -a
sleep 2
$PROG -R `cat $TMP4` -L 10M
$PROG -R $(cat $TMP4) -L 10M
) &
$PROG -L 2M -f -P $TMP4 $TMP1 > $TMP2 2>$TMP3
# Make sure there is more than one length of line (excluding blank lines).
line_lengths=`tr '\r' '\n' < "$TMP3" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l`
line_lengths=$(tr '\r' '\n' < "$TMP3" | awk '{print length($0)}' | grep -Fvx 0 | sort -n | uniq | wc -l)
test $line_lengths -gt 1
# EOF
+9 -9
View File
@@ -24,18 +24,18 @@ echo FAIL > $TMP3
set +e
sleep 2
for x in 1 2 3; do
$PROG -R `cat $TMP4` -apterb || exit 1
$PROG -R $(cat $TMP4) -apterb || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
$PROG -R `cat $TMP4` -p || exit 1
$PROG -R $(cat $TMP4) -p || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
$PROG -R `cat $TMP4` -N "test" || exit 1
$PROG -R $(cat $TMP4) -N "test" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
$PROG -R `cat $TMP4` -F "%e" || exit 1
$PROG -R $(cat $TMP4) -F "%e" || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
$PROG -R `cat $TMP4` -N "." || exit 1
$PROG -R $(cat $TMP4) -N "." || exit 1
(usleep 200000 || sleep 1) 2>/dev/null
done
$PROG -R `cat $TMP4` -L 10M
$PROG -R $(cat $TMP4) -L 10M
echo OK > $TMP3
) &
@@ -43,12 +43,12 @@ echo OK > $TMP3
$PROG -L 100k -i 0.1 -f -P $TMP4 $TMP1 > $TMP2 2>/dev/null
# Check our remote control calls ran OK.
BGSTATUS=`cat $TMP3`
BGSTATUS=$(cat $TMP3)
test "x$BGSTATUS" = "xOK"
# Check data integrity.
CKSUM1=`cksum $TMP1 | awk '{print $1}'`
CKSUM2=`cksum $TMP2 | awk '{print $1}'`
CKSUM1=$(cksum $TMP1 | awk '{print $1}')
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
test "x$CKSUM1" = "x$CKSUM2"
# EOF
+2 -2
View File
@@ -13,12 +13,12 @@ dd if=/dev/urandom of=$TMP1 bs=1024 count=10 2>/dev/null
# read through pv and test afterwards
$PROG -S -s 5120 -q $TMP1 > $TMP2
CKSUM2=`cksum $TMP2 | awk '{print $1}'`
CKSUM2=$(cksum $TMP2 | awk '{print $1}')
# take the first 5120 bytes of TMP1 and cksum them
rm -f $TMP2
dd if=$TMP1 of=$TMP2 bs=1024 count=5 2>/dev/null
CKSUM1=`cksum $TMP2 | awk '{print $1}'`
CKSUM1=$(cksum $TMP2 | awk '{print $1}')
test "x$CKSUM1" = "x$CKSUM2"