From bf9c60078a8c65e5de3dddc39762d30c49f86577 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 11 Sep 2018 10:59:09 -0700 Subject: [PATCH] don't use $() in system tests --- bin/tests/system/cds/setup.sh | 17 +++++++++-------- bin/tests/system/rrsetorder/tests.sh | 12 ++++++------ doc/dev/style.md | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bin/tests/system/cds/setup.sh b/bin/tests/system/cds/setup.sh index e72a4dc94d..da4a41221f 100644 --- a/bin/tests/system/cds/setup.sh +++ b/bin/tests/system/cds/setup.sh @@ -20,13 +20,13 @@ touch empty Z=cds.test -keyz=$($KEYGEN -q -a RSASHA256 $Z) -key1=$($KEYGEN -q -a RSASHA256 -f KSK $Z) -key2=$($KEYGEN -q -a RSASHA256 -f KSK $Z) +keyz=`$KEYGEN -q -a RSASHA256 $Z` +key1=`$KEYGEN -q -a RSASHA256 -f KSK $Z` +key2=`$KEYGEN -q -a RSASHA256 -f KSK $Z` -idz=$(echo $keyz | sed 's/.*+0*//') -id1=$(echo $key1 | sed 's/.*+0*//') -id2=$(echo $key2 | sed 's/.*+0*//') +idz=`echo $keyz | sed 's/.*+0*//'` +id1=`echo $key1 | sed 's/.*+0*//'` +id2=`echo $key2 | sed 's/.*+0*//'` cat <vars.sh Z=$Z @@ -120,10 +120,11 @@ $mangle '\s+IN\s+RRSIG\s+CDS .* '$id1' '$Z'\. ' \ $mangle " IN CDS $id1 8 1 " /dev/null 2>&1 ; then @@ -139,7 +139,7 @@ do eval "match=\`expr \$match + \$match$i\`" done echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" -if [ $match -lt $(((${GOOD_RANDOM_NO}/3))) ]; then ret=1; fi +if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -233,7 +233,7 @@ do eval "match=\`expr \$match + \$match$i\`" done echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" -if [ $match -lt $(((${GOOD_RANDOM_NO}/3))) ]; then ret=1; fi +if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -343,7 +343,7 @@ do eval "match=\`expr \$match + \$match$i\`" done echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" -if [ $match -lt $(((${GOOD_RANDOM_NO}/3))) ]; then ret=1; fi +if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -441,7 +441,7 @@ do eval "match=\`expr \$match + \$match$i\`" done echo_i "Random selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" -if [ $match -lt $(((${GOOD_RANDOM_NO}/3))) ]; then ret=1; fi +if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi echo_i "Checking default order (cache)" @@ -467,7 +467,7 @@ do eval "match=\`expr \$match + \$match$i\`" done echo_i "Default selection return $match of ${GOOD_RANDOM_NO} possible orders in 36 samples" -if [ $match -lt $(((${GOOD_RANDOM_NO}/3))) ]; then ret=1; fi +if [ $match -lt `expr ${GOOD_RANDOM_NO} / 3` ]; then ret=1; fi if [ $ret != 0 ]; then echo_i "failed"; fi echo_i "Checking default order no match in rrset-order (no shuffling)" diff --git a/doc/dev/style.md b/doc/dev/style.md index 49b725452a..89a6b506a4 100644 --- a/doc/dev/style.md +++ b/doc/dev/style.md @@ -749,7 +749,7 @@ Bash should be avoided. Some pitfalls to avoid: `$(parentheses)` * For arithmetical computation, use `` `expr {expression}` ``, not `$((expression))` -* To text string length use `` `expr $string : ".*"` `` rather than `` +* To test string length use `` `expr $string : ".*"` `` rather than `` `expr length $string` `` * To test for the presence of a string in a file without printing anything to stdout, use `"grep string filename > /dev/null 2>&1"`, rather than