summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/close-stdout4
-rwxr-xr-xtests/misc/date-sec6
-rwxr-xr-xtests/misc/df2
-rwxr-xr-xtests/misc/env18
-rwxr-xr-xtests/misc/head-c2
-rwxr-xr-xtests/misc/ls-time12
-rwxr-xr-xtests/misc/mknod6
-rwxr-xr-xtests/misc/nice14
-rwxr-xr-xtests/misc/nohup2
-rwxr-xr-xtests/misc/od-multiple-t10
-rwxr-xr-xtests/misc/runcon-no-reorder2
-rwxr-xr-xtests/misc/selinux10
-rwxr-xr-xtests/misc/shuf2
-rwxr-xr-xtests/misc/sort-compress2
-rwxr-xr-xtests/misc/sort-merge-fdlimit2
-rwxr-xr-xtests/misc/sort-rand2
-rwxr-xr-xtests/misc/stat-fmt6
-rwxr-xr-xtests/misc/stty12
-rwxr-xr-xtests/misc/stty-invalid6
-rwxr-xr-xtests/misc/stty-row-col10
-rwxr-xr-xtests/misc/tee4
-rwxr-xr-xtests/misc/timeout2
22 files changed, 68 insertions, 68 deletions
diff --git a/tests/misc/close-stdout b/tests/misc/close-stdout
index 8af84c214..8584dfea4 100755
--- a/tests/misc/close-stdout
+++ b/tests/misc/close-stdout
@@ -49,7 +49,7 @@ if "$p/src/test" -w /dev/stdout >/dev/null &&
rm -Rf tmpfile-?????? || fail=1
mktemp tmpfile-XXXXXX >&- 2>/dev/null && fail=1
mktemp tmpfile-XXXXXX -q >&- 2>/dev/null && fail=1
- case `echo tmpfile-??????` in 'tmpfile-??????') ;; *) fail=1 ;; esac
+ case $(echo tmpfile-??????) in 'tmpfile-??????') ;; *) fail=1 ;; esac
fi
# Likewise for /dev/full, if /dev/full works.
@@ -59,7 +59,7 @@ if test -w /dev/full && test -c /dev/full; then
rm -Rf tmpdir-?????? || fail=1
mktemp -d tmpdir-XXXXXX >/dev/full 2>/dev/null && fail=1
mktemp -d -q tmpdir-XXXXXX >/dev/full 2>/dev/null && fail=1
- case `echo tmpfile-??????` in 'tmpfile-??????') ;; *) fail=1 ;; esac
+ case $(echo tmpfile-??????) in 'tmpfile-??????') ;; *) fail=1 ;; esac
fi
Exit $fail
diff --git a/tests/misc/date-sec b/tests/misc/date-sec
index 817e9243f..df77fe7bd 100755
--- a/tests/misc/date-sec
+++ b/tests/misc/date-sec
@@ -24,13 +24,13 @@ print_ver_ date
# It would be easier simply to sleep for two seconds between two runs
-# of `date --date="21:04 +0100" +%S` and ensure that both outputs
+# of $(date --date="21:04 +0100" +%S) and ensure that both outputs
# are '00', but I prefer not to sleep unconditionally. 'make check'
# takes long enough as it is.
n=0
# See if the current number of seconds is '00' or just before.
-s=`date +%S`
+s=$(date +%S)
case "$s" in
58) n=3;;
59) n=2;;
@@ -40,7 +40,7 @@ esac
# If necessary, wait for the system clock to pass the minute mark.
test $n = 0 || sleep $n
-s=`date --date="21:04 +0100" +%S`
+s=$(date --date="21:04 +0100" +%S)
case "$s" in
00) ;;
*) fail=1;;
diff --git a/tests/misc/df b/tests/misc/df
index fe5be3f3f..4fc626e8f 100755
--- a/tests/misc/df
+++ b/tests/misc/df
@@ -19,7 +19,7 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ df
-case `df .` in
+case $(df .) in
*'
'*) ;;
*) fail=1;;
diff --git a/tests/misc/env b/tests/misc/env
index ec9f0af1e..6f8c064ce 100755
--- a/tests/misc/env
+++ b/tests/misc/env
@@ -95,8 +95,8 @@ echo pass
EOF
chmod +x unlikely_name/also_unlikely || framework_failure_
env also_unlikely && fail=1
-test x`PATH=$PATH:unlikely_name env also_unlikely` = xpass || fail=1
-test x`env PATH="$PATH":unlikely_name also_unlikely` = xpass || fail=1
+test x$(PATH=$PATH:unlikely_name env also_unlikely) = xpass || fail=1
+test x$(env PATH="$PATH":unlikely_name also_unlikely) = xpass || fail=1
# Explicitly put . on the PATH for the rest of this test.
PATH=$PATH:
@@ -108,15 +108,15 @@ export PATH
# Avoid the issue by using an executable rather than a script.
# Test -u, rather than -i, to minimize PATH problems.
ln -s "$abs_top_builddir/src/echo" ./-u || framework_failure_
-case `env -u echo echo good` in
+case $(env -u echo echo good) in
good) ;;
*) fail=1 ;;
esac
-case `env -u echo -- echo good` in
+case $(env -u echo -- echo good) in
good) ;;
*) fail=1 ;;
esac
-case `env -- -u pass` in
+case $(env -- -u pass) in
pass) ;;
*) fail=1 ;;
esac
@@ -125,7 +125,7 @@ esac
env a=b -- true
test $? = 127 || fail=1
ln -s "$abs_top_builddir/src/echo" ./-- || framework_failure_
-case `env a=b -- true || echo fail` in
+case $(env a=b -- true || echo fail) in
true) ;;
*) fail=1 ;;
esac
@@ -136,9 +136,9 @@ cat <<EOF >./c=d || framework_failure_
echo pass
EOF
chmod +x c=d || framework_failure_
-test "x`env c=d echo fail`" = xfail || fail=1
-test "x`env -- c=d echo fail`" = xfail || fail=1
-test "x`env ./c=d echo fail`" = xfail || fail=1
+test "x$(env c=d echo fail)" = xfail || fail=1
+test "x$(env -- c=d echo fail)" = xfail || fail=1
+test "x$(env ./c=d echo fail)" = xfail || fail=1
test "x$(env sh -c 'exec "$@"' sh c=d echo fail)" = xpass || fail=1
test "x$(sh -c '\c=d echo fail')" = xpass && #dash 0.5.4 fails so check first
{ test "x$(env sh -c '\c=d echo fail')" = xpass || fail=1; }
diff --git a/tests/misc/head-c b/tests/misc/head-c
index 8a768a42a..32f86d2f3 100755
--- a/tests/misc/head-c
+++ b/tests/misc/head-c
@@ -22,7 +22,7 @@ print_ver_ head
echo abc > in || framework_failure_
(head -c1; head -c1) < in > out || fail=1
-case "`cat out`" in
+case "$(cat out)" in
ab) ;;
*) fail=1 ;;
esac
diff --git a/tests/misc/ls-time b/tests/misc/ls-time
index a99829480..7bc3c642b 100755
--- a/tests/misc/ls-time
+++ b/tests/misc/ls-time
@@ -47,7 +47,7 @@ touch -a -d "$u1" a || framework_failure_
# A has ctime more recent than C.
-set `ls -c a c`
+set $(ls -c a c)
test "$*" = 'a c' || fail=1
# Sleep so long in an attempt to avoid spurious failures
@@ -58,7 +58,7 @@ sleep 2
ln c d || framework_failure_
# Before we go any further, verify that touch's -m option works.
-set -- `ls --full -l a`
+set -- $(ls --full -l a)
case "$*" in
*" $t3:00.000000000 +0000 a") ;;
*)
@@ -77,7 +77,7 @@ EOF
esac
# Ensure that touch's -a option works.
-set -- `ls --full -lu a`
+set -- $(ls --full -lu a)
case "$*" in
*" $u1:00.000000000 +0000 a") ;;
*)
@@ -94,16 +94,16 @@ EOF
;;
esac
-set `ls -ut a b c`
+set $(ls -ut a b c)
test "$*" = 'c b a' && : || fail=1
test $fail = 1 && ls -l --full-time --time=access a b c
-set `ls -t a b c`
+set $(ls -t a b c)
test "$*" = 'a b c' && : || fail=1
test $fail = 1 && ls -l --full-time a b c
# Now, C should have ctime more recent than A.
-set `ls -ct a c`
+set $(ls -ct a c)
if test "$*" = 'c a'; then
: ok
else
diff --git a/tests/misc/mknod b/tests/misc/mknod
index 09334b826..b9e33ad2d 100755
--- a/tests/misc/mknod
+++ b/tests/misc/mknod
@@ -25,15 +25,15 @@ mkfifo_or_skip_ fifo
umask 777
mknod -m 734 f1 p || fail=1
-mode=`ls -dgo f1|cut -b-10`
+mode=$(ls -dgo f1|cut -b-10)
test $mode = prwx-wxr-- || fail=1
mkfifo -m 734 f2 || fail=1
-mode=`ls -dgo f2|cut -b-10`
+mode=$(ls -dgo f2|cut -b-10)
test $mode = prwx-wxr-- || fail=1
mkdir -m 734 f3 || fail=1
-mode=`ls -dgo f3|cut -b-10`
+mode=$(ls -dgo f3|cut -b-10)
test $mode = drwx-wxr-- || test $mode = drwx-wsr-- || fail=1
Exit $fail
diff --git a/tests/misc/nice b/tests/misc/nice
index cbc135fda..ac8ea04ea 100755
--- a/tests/misc/nice
+++ b/tests/misc/nice
@@ -45,7 +45,7 @@ NA LAST NA
set $tests
# Require that this test be run at 'nice' level 0.
-niceness=`nice`
+niceness=$(nice)
if test "$niceness" = 0; then
: ok
else
@@ -58,19 +58,19 @@ while :; do
expected_result=$3
test $args = empty && args=''
test x$args = xLAST && break
- args=`echo x$args|tr : ' '|sed 's/^x//'`
+ args=$(echo x$args|tr : ' '|sed 's/^x//')
if test "$VERBOSE" = yes; then
- #echo "testing \`nice $args nice\` = $expected_result ..."
+ #echo "testing \$(nice $args nice\) = $expected_result ..."
echo "test $test_name... " | tr -d '\n'
fi
- test x`nice $args nice 2> /dev/null` = x$expected_result \
+ test x$(nice $args nice 2> /dev/null) = x$expected_result \
&& ok=ok || ok=FAIL fail=1
test "$VERBOSE" = yes && echo $ok
shift; shift; shift
done
# Test negative niceness - command must be run whether or not change happens.
-if test x`nice -n -1 nice 2> /dev/null` = x0 ; then
+if test x$(nice -n -1 nice 2> /dev/null) = x0 ; then
# unprivileged user - warn about failure to change
nice -n -1 true 2> err || fail=1
test -s err || fail=1
@@ -87,8 +87,8 @@ else
# superuser - change succeeds
nice -n -1 nice 2> err || fail=1
test -s err && fail=1
- test x`nice -n -1 nice` = x-1 || fail=1
- test x`nice --1 nice` = x-1 || fail=1
+ test x$(nice -n -1 nice) = x-1 || fail=1
+ test x$(nice --1 nice) = x-1 || fail=1
fi
Exit $fail
diff --git a/tests/misc/nohup b/tests/misc/nohup
index cef8ee8fc..76f676d81 100755
--- a/tests/misc/nohup
+++ b/tests/misc/nohup
@@ -25,7 +25,7 @@ nohup sh -c 'echo stdout; echo stderr 1>&2' 2>err || fail=1
# Be careful. The results of the above nohup command
# change depending on whether stdin and stdout are redirected.
if test -t 1; then
- test "`cat nohup.out`" = stdout || fail=1
+ test "$(cat nohup.out)" = stdout || fail=1
if test -t 0; then
echo 'nohup: ignoring input and appending output to 'nohup.out'\'
else
diff --git a/tests/misc/od-multiple-t b/tests/misc/od-multiple-t
index 1f607bc87..049273cdf 100755
--- a/tests/misc/od-multiple-t
+++ b/tests/misc/od-multiple-t
@@ -23,17 +23,17 @@ print_ver_ od
# Choose 48 bytes for the input, as that is lcm for 1, 2, 4, 8, 12, 16;
# we don't anticipate any other native object size on modern hardware.
seq 19 > in || framework_failure_
-test `wc -c < in` -eq 48 || framework_failure_
+test $(wc -c < in) -eq 48 || framework_failure_
list='a c dC dS dI dL oC oS oI oL uC uS uI uL xC xS xI xL fF fD fL'
for format1 in $list; do
for format2 in $list; do
od -An -t${format1}z -t${format2}z in > out-raw || fail=1
- linewidth=`head -n1 out-raw | wc -c`
- linecount=`wc -l < out-raw`
- echo $format1 $format2 `wc -c < out-raw` >> out
- echo $format1 $format2 `expr $linewidth '*' $linecount` >> exp
+ linewidth=$(head -n1 out-raw | wc -c)
+ linecount=$(wc -l < out-raw)
+ echo $format1 $format2 $(wc -c < out-raw) >> out
+ echo $format1 $format2 $(expr $linewidth '*' $linecount) >> exp
done
done
diff --git a/tests/misc/runcon-no-reorder b/tests/misc/runcon-no-reorder
index 6f282d9c0..351896ef8 100755
--- a/tests/misc/runcon-no-reorder
+++ b/tests/misc/runcon-no-reorder
@@ -33,7 +33,7 @@ runcon $(id -Z) true -j 2> out && : > exp
# it chcon fails with this: "runcon: invalid context: \
# root:system_r:unconfined_t:s0-s0:c0.c1023: No such file or directory"
# That diagnostic is ok, too, so map it to the more common one.
-case `cat out` in
+case $(cat out) in
'runcon: invalid context: '*) echo "$diag" > out;;
esac
diff --git a/tests/misc/selinux b/tests/misc/selinux
index 810996c87..12ae15f4e 100755
--- a/tests/misc/selinux
+++ b/tests/misc/selinux
@@ -37,23 +37,23 @@ chcon $ctx f d p ||
# inspect that context with both ls -Z and stat.
for i in d f p; do
- c=`ls -dogZ $i|cut -d' ' -f3`; test x$c = x$ctx || fail=1
- c=`stat --printf %C $i`; test x$c = x$ctx || fail=1
+ c=$(ls -dogZ $i|cut -d' ' -f3); test x$c = x$ctx || fail=1
+ c=$(stat --printf %C $i); test x$c = x$ctx || fail=1
done
# ensure that ls -l output includes the ".".
-c=`ls -l f|cut -c11`; test "$c" = . || fail=1
+c=$(ls -l f|cut -c11); test "$c" = . || fail=1
# Copy each to a new directory and ensure that context is preserved.
cp -r --preserve=all d f p s1 || fail=1
for i in d f p; do
- c=`stat --printf %C s1/$i`; test x$c = x$ctx || fail=1
+ c=$(stat --printf %C s1/$i); test x$c = x$ctx || fail=1
done
# Now, move each to a new directory and ensure that context is preserved.
mv d f p s2 || fail=1
for i in d f p; do
- c=`stat --printf %C s2/$i`; test x$c = x$ctx || fail=1
+ c=$(stat --printf %C s2/$i); test x$c = x$ctx || fail=1
done
Exit $fail
diff --git a/tests/misc/shuf b/tests/misc/shuf
index 8fdbdd9f2..243c0498d 100755
--- a/tests/misc/shuf
+++ b/tests/misc/shuf
@@ -40,7 +40,7 @@ sort -n out > out1
compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
# Exercise shuf's -e option.
-t=`shuf -e a b c d e | sort | fmt`
+t=$(shuf -e a b c d e | sort | fmt)
test "$t" = 'a b c d e' || { fail=1; echo "not a permutation" 1>&2; }
# Before coreutils-6.3, this would infloop.
diff --git a/tests/misc/sort-compress b/tests/misc/sort-compress
index 9a4b9f622..00dcf06ac 100755
--- a/tests/misc/sort-compress
+++ b/tests/misc/sort-compress
@@ -39,7 +39,7 @@ chmod +x gzip
# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
(
# ash doesn't support "trap '' CHLD"; it knows only signal numbers.
- sig=`"$abs_top_builddir/src/kill" -l CHLD 2>/dev/null` && trap '' $sig
+ sig=$("$abs_top_builddir/src/kill" -l CHLD 2>/dev/null) && trap '' $sig
# This should force the use of child processes for "compression"
PATH=.:$PATH exec sort -S 1k --compress-program=gzip in > /dev/null
diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit
index d206494a1..7ce109c1a 100755
--- a/tests/misc/sort-merge-fdlimit
+++ b/tests/misc/sort-merge-fdlimit
@@ -24,7 +24,7 @@ require_ulimit_
mkdir in err || framework_failure_
-for i in `seq 17`; do
+for i in $(seq 17); do
echo $i >in/$i
done
seq 17 >some-data
diff --git a/tests/misc/sort-rand b/tests/misc/sort-rand
index c9fce0aa7..79730e957 100755
--- a/tests/misc/sort-rand
+++ b/tests/misc/sort-rand
@@ -35,7 +35,7 @@ compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
# If locale is available then use it to find a random non-C locale.
if (locale --version) > /dev/null 2>&1; then
- locale=`locale -a | sort --random-sort | awk '/^.._/{print;exit}'`
+ locale=$(locale -a | sort --random-sort | awk '/^.._/{print;exit}')
LC_ALL=$locale sort --random-sort in > out1 || fail=1
LC_ALL=$locale sort --random-sort in > out2 || fail=1
diff --git a/tests/misc/stat-fmt b/tests/misc/stat-fmt
index af428151f..8952a7abb 100755
--- a/tests/misc/stat-fmt
+++ b/tests/misc/stat-fmt
@@ -21,9 +21,9 @@ print_ver_ stat
-for i in `seq 50`; do
- fmt=`printf "%${i}s" %`
- out=`stat --form="$fmt" .`
+for i in $(seq 50); do
+ fmt=$(printf "%${i}s" %)
+ out=$(stat --form="$fmt" .)
test "$out" = "$fmt" || fail=1
done
diff --git a/tests/misc/stty b/tests/misc/stty
index 650231f16..97020e8fe 100755
--- a/tests/misc/stty
+++ b/tests/misc/stty
@@ -40,7 +40,7 @@ REV_cbreak=1 REV_decctlq=1 REV_tabs=1 REV_lcase=1 REV_LCASE=1
saved_state=.saved-state
stty --save > $saved_state || fail=1
-stty `cat $saved_state` || fail=1
+stty $(cat $saved_state) || fail=1
# This would segfault prior to sh-utils-2.0j.
stty erase - || fail=1
@@ -54,7 +54,7 @@ stty -raw -a 2>/dev/null && fail=1
# Don't depend on terminal width. Put each option on its own line,
# remove all non-boolean ones, then remove any leading hyphens.
sed_del='/^speed/d;/^rows/d;/^columns/d;/ = /d'
-options=`stty -a | tr -s ';' '\n' | sed "s/^ //;$sed_del;s/-//g"`
+options=$(stty -a | tr -s ';' '\n' | sed "s/^ //;$sed_del;s/-//g")
# Take them one at a time, with and without the leading '-'.
for opt in $options; do
@@ -70,7 +70,7 @@ for opt in $options; do
# Likewise, 'stty -cread' would fail, so skip that, too.
test $opt = cread && continue
- rev=`eval echo "\\\$REV_$opt"`
+ rev=$(eval echo "\$REV_$opt")
if test -n "$rev"; then
stty -$opt || { fail=1; echo -$opt; }
fi
@@ -84,8 +84,8 @@ if test -n "$RUN_LONG_TESTS"; then
stty $opt1 $opt2 || fail=1
- rev1=`eval echo "\\\$REV_$opt1"`
- rev2=`eval echo "\\\$REV_$opt2"`
+ rev1=$(eval echo "\$REV_$opt1")
+ rev2=$(eval echo "\$REV_$opt2")
if test -n "$rev1"; then
stty -$opt1 $opt2 || fail=1
fi
@@ -99,6 +99,6 @@ if test -n "$RUN_LONG_TESTS"; then
done
fi
-stty `cat $saved_state`
+stty $(cat $saved_state)
Exit $fail
diff --git a/tests/misc/stty-invalid b/tests/misc/stty-invalid
index 2be98437e..3b035ecef 100755
--- a/tests/misc/stty-invalid
+++ b/tests/misc/stty-invalid
@@ -22,7 +22,7 @@ require_controlling_input_terminal_
trap '' TTOU # Ignore SIGTTOU
-saved_state=`stty -g` || fail=1
+saved_state=$(stty -g) || fail=1
stty $saved_state || fail=1
# Before coreutils-6.9.90, if stty were given an argument with 35 colons
@@ -34,8 +34,8 @@ stty $saved_state || fail=1
# For each of the following, with coreutils-6.9 and earlier,
# stty would fail to diagnose the error on at least Solaris 10.
hex_2_64=10000000000000000
-stty `echo $saved_state |sed 's/^[^:]*:/'$hex_2_64:/` 2>/dev/null && fail=1
-stty `echo $saved_state |sed 's/:[0-9a-f]*$/:'$hex_2_64/` 2>/dev/null && fail=1
+stty $(echo $saved_state |sed 's/^[^:]*:/'$hex_2_64:/) 2>/dev/null && fail=1
+stty $(echo $saved_state |sed 's/:[0-9a-f]*$/:'$hex_2_64/) 2>/dev/null && fail=1
# Just in case either of the above mistakenly succeeds (and changes
# the state of our tty), try to restore the initial state.
diff --git a/tests/misc/stty-row-col b/tests/misc/stty-row-col
index bcbc7bc64..d7151d5b7 100755
--- a/tests/misc/stty-row-col
+++ b/tests/misc/stty-row-col
@@ -51,7 +51,7 @@ NA LAST NA
'
set $tests
-saved_size=`stty size` && test -n "$saved_size" \
+saved_size=$(stty size) && test -n "$saved_size" \
|| skip_ "can't get window size"
# Linux virtual consoles issue an error if you
@@ -66,16 +66,16 @@ fi
while :; do
test_name=$1
args=$2
- expected_result="`echo $3|tr _ ' '`"
+ expected_result="$(echo $3|tr _ ' ')"
test "$args" = empty && args=''
test "x$args" = xLAST && break
- args=`echo x$args|tr _ ' '|sed 's/^x//'`
+ args=$(echo x$args|tr _ ' '|sed 's/^x//')
if test "$VERBOSE" = yes; then
- # echo "testing \`stty $args; stty size\` = $expected_result ..."
+ # echo "testing \$(stty $args; stty size\) = $expected_result ..."
echo "test $test_name... " | tr -d '\n'
fi
stty $args || exit 1
- test x"`stty size 2> /dev/null`" = "x$expected_result" \
+ test x"$(stty size 2> /dev/null)" = "x$expected_result" \
&& ok=ok || ok=FAIL fail=1
test "$VERBOSE" = yes && echo $ok
shift; shift; shift
diff --git a/tests/misc/tee b/tests/misc/tee
index 8607c612c..4c17316d3 100755
--- a/tests/misc/tee
+++ b/tests/misc/tee
@@ -20,10 +20,10 @@
print_ver_ tee
echo line >sample || framework_failure_
-nums=`seq 9` || framework_failure_
+nums=$(seq 9) || framework_failure_
for n in 0 $nums; do
- files=`seq $n`
+ files=$(seq $n)
rm -f $files
tee $files <sample >out || fail=1
for f in out $files; do
diff --git a/tests/misc/timeout b/tests/misc/timeout
index d69e2f21b..5f4e9ec2a 100755
--- a/tests/misc/timeout
+++ b/tests/misc/timeout
@@ -46,7 +46,7 @@ test $? = 124 && fail=1
# Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh.
(
# ash doesn't support "trap '' CHLD"; it knows only signal numbers.
- sig=`"$abs_top_builddir/src/kill" -l CHLD 2>/dev/null` && trap '' $sig
+ sig=$("$abs_top_builddir/src/kill" -l CHLD 2>/dev/null) && trap '' $sig
exec timeout 10 true
) || fail=1