From e43d30eab3215bc9ff49ec7db3d3e2baa95ba070 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 3 Apr 2012 20:32:44 +0200 Subject: [PATCH] tests: convert nearly all `...` expressions to $(...) Exempt init.sh because it runs before we're assured to have a shell that groks $(...). Exempt *.mk because "$" would have to be doubled, and besides, any `...` expression in a .mk file is almost certainly evaluated before init.sh is run. Finally, also exempt the perl-based tests, because perl's `...` cannot be converted to $(...). Do that by running this command: git grep -l '`.*`' tests \ | grep -Ev 'init\.sh|\.mk$' | xargs grep -Lw perl \ | xargs perl -pi -e 's/`(.*?)`/\$($1)/g' One minor fix-up change was required after that, due to how quoting differs: diff --git a/tests/chmod/equals b/tests/chmod/equals - expected_perms=$(eval 'echo \$expected_'$dest) + expected_perms=$(eval 'echo $expected_'$dest) Another was to make these required quoting adjustments: diff --git a/tests/misc/stty b/tests/misc/stty ... - rev=$(eval echo "\\\$REV_$opt") + rev=$(eval echo "\$REV_$opt") ... - rev1=$(eval echo "\\\$REV_$opt1") - rev2=$(eval echo "\\\$REV_$opt2") + rev1=$(eval echo "\$REV_$opt1") + rev2=$(eval echo "\$REV_$opt2") Also, transform two files that were needlessly excluded above: (both use perl, but are mostly bourne shell) perl -pi -e 's/`(.*?)`/\$($1)/g' \ tests/du/long-from-unreadable tests/init.cfg --- tests/chgrp/basic | 46 +++++++++++----------- tests/chgrp/default-no-deref | 4 +- tests/chgrp/deref | 18 ++++----- tests/chgrp/posix-H | 4 +- tests/chgrp/recurse | 10 ++--- tests/chmod/c-option | 2 +- tests/chmod/equal-x | 2 +- tests/chmod/equals | 6 +-- tests/chmod/setgid | 4 +- tests/chmod/usage | 6 +-- tests/chown/basic | 12 +++--- tests/chown/deref | 2 +- tests/chown/preserve-root | 8 ++-- tests/chown/separator | 8 ++-- tests/cp/acl | 10 ++--- tests/cp/cp-a-selinux | 2 +- tests/cp/cp-mv-backup | 2 +- tests/cp/cp-mv-enotsup-xattr | 2 +- tests/cp/cp-parents | 10 ++--- tests/cp/fail-perm | 2 +- tests/cp/fiemap-empty | 2 +- tests/cp/file-perm-race | 2 +- tests/cp/link-preserve | 26 ++++++------- tests/cp/link-symlink | 4 +- tests/cp/no-deref-link1 | 2 +- tests/cp/no-deref-link2 | 2 +- tests/cp/no-deref-link3 | 2 +- tests/cp/parent-perm-race | 2 +- tests/cp/perm | 4 +- tests/cp/preserve-gid | 2 +- tests/cp/preserve-link | 2 +- tests/cp/r-vs-symlink | 2 +- tests/cp/same-file | 2 +- tests/cp/sparse | 4 +- tests/cp/special-bits | 12 +++--- tests/cp/symlink-slash | 2 +- tests/dd/bytes | 6 +-- tests/dd/misc | 6 +-- tests/dd/not-rewound | 2 +- tests/dd/skip-seek2 | 4 +- tests/du/2g | 4 +- tests/du/8gb | 2 +- tests/du/basic | 26 ++++++------- tests/du/deref | 6 +-- tests/du/inaccessible-cwd | 2 +- tests/du/long-from-unreadable | 6 +-- tests/du/long-sloop | 6 +-- tests/du/slink | 2 +- tests/init.cfg | 16 ++++---- tests/install/basic-1 | 4 +- tests/install/trap | 2 +- tests/ln/hard-to-sym | 10 ++--- tests/ln/misc | 2 +- tests/ln/sf-1 | 2 +- tests/ls/inode | 12 +++--- tests/ls/nameless-uid | 2 +- tests/ls/stat-dtype | 2 +- tests/ls/stat-vs-dirent | 12 +++--- tests/ls/symlink-slash | 2 +- tests/misc/close-stdout | 4 +- tests/misc/date-sec | 6 +-- tests/misc/df | 2 +- tests/misc/env | 18 ++++----- tests/misc/head-c | 2 +- tests/misc/ls-time | 12 +++--- tests/misc/mknod | 6 +-- tests/misc/nice | 14 +++---- tests/misc/nohup | 2 +- tests/misc/od-multiple-t | 10 ++--- tests/misc/runcon-no-reorder | 2 +- tests/misc/selinux | 10 ++--- tests/misc/shuf | 2 +- tests/misc/sort-compress | 2 +- tests/misc/sort-merge-fdlimit | 2 +- tests/misc/sort-rand | 2 +- tests/misc/stat-fmt | 6 +-- tests/misc/stty | 12 +++--- tests/misc/stty-invalid | 6 +-- tests/misc/stty-row-col | 10 ++--- tests/misc/tee | 4 +- tests/misc/timeout | 2 +- tests/mkdir/p-1 | 2 +- tests/mkdir/p-2 | 2 +- tests/mkdir/p-3 | 4 +- tests/mkdir/parents | 12 +++--- tests/mkdir/perm | 2 +- tests/mkdir/special-1 | 4 +- tests/mv/acl | 12 +++--- tests/mv/atomic | 2 +- tests/mv/atomic2 | 2 +- tests/mv/childproof | 8 ++-- tests/mv/force | 2 +- tests/mv/hard-2 | 12 +++--- tests/mv/hard-3 | 6 +-- tests/mv/hard-link-1 | 4 +- tests/mv/i-2 | 2 +- tests/mv/i-3 | 4 +- tests/mv/i-4 | 2 +- tests/mv/i-link-no | 2 +- tests/mv/leak-fd | 6 +-- tests/mv/part-hardlink | 4 +- tests/mv/part-symlink | 12 +++--- tests/mv/partition-perm | 2 +- tests/mv/to-symlink | 2 +- tests/mv/update | 10 ++--- tests/other-fs-tmpdir | 4 +- tests/readlink/can-e | 40 +++++++++---------- tests/readlink/can-f | 72 +++++++++++++++++------------------ tests/readlink/can-m | 64 +++++++++++++++---------------- tests/readlink/rl-1 | 10 ++--- tests/rm/hash | 2 +- tests/rm/inaccessible | 2 +- tests/rm/ir-1 | 2 +- tests/rm/read-only | 2 +- tests/rm/readdir-bug | 4 +- tests/rm/unread3 | 2 +- tests/rmdir/ignore | 2 +- tests/tail-2/assert | 2 +- tests/tail-2/assert-2 | 2 +- tests/touch/dangling-symlink | 2 +- tests/touch/empty-file | 6 +-- tests/touch/no-dereference | 4 +- tests/touch/no-rights | 4 +- tests/touch/trailing-slash | 6 +-- 124 files changed, 429 insertions(+), 429 deletions(-) diff --git a/tests/chgrp/basic b/tests/chgrp/basic index 9c384ba38..8ce2f2ddc 100755 --- a/tests/chgrp/basic +++ b/tests/chgrp/basic @@ -33,53 +33,53 @@ chgrp -R $g1 d || fail=1 d_files='d d/f3' -chgrp $g1 f || fail=1 ; test `stat --p=%g f` = $g1 || fail=1 -chgrp $g2 f || fail=1 ; test `stat --p=%g f` = $g2 || fail=1 -chgrp $g2 f || fail=1 ; test `stat --p=%g f` = $g2 || fail=1 -chgrp '' f || fail=1 ; test `stat --p=%g f` = $g2 || fail=1 -chgrp $g1 f || fail=1 ; test `stat --p=%g f` = $g1 || fail=1 -chgrp $g1 f || fail=1 ; test `stat --p=%g f` = $g1 || fail=1 -chgrp --reference=f2 f ; test `stat --p=%g f` = $g2 || fail=1 +chgrp $g1 f || fail=1 ; test $(stat --p=%g f) = $g1 || fail=1 +chgrp $g2 f || fail=1 ; test $(stat --p=%g f) = $g2 || fail=1 +chgrp $g2 f || fail=1 ; test $(stat --p=%g f) = $g2 || fail=1 +chgrp '' f || fail=1 ; test $(stat --p=%g f) = $g2 || fail=1 +chgrp $g1 f || fail=1 ; test $(stat --p=%g f) = $g1 || fail=1 +chgrp $g1 f || fail=1 ; test $(stat --p=%g f) = $g1 || fail=1 +chgrp --reference=f2 f ; test $(stat --p=%g f) = $g2 || fail=1 -chgrp -R $g2 d ||fail=1; test `stat --p=%g: $d_files` = "$g2:$g2:" || fail=1 -chgrp -R $g1 d ||fail=1; test `stat --p=%g: $d_files` = "$g1:$g1:" || fail=1 -chgrp -R $g2 d ||fail=1; test `stat --p=%g: $d_files` = "$g2:$g2:" || fail=1 -chgrp -R $g1 d ||fail=1; test `stat --p=%g: $d_files` = "$g1:$g1:" || fail=1 -chgrp $g2 d ||fail=1; test `stat --p=%g: $d_files` = "$g2:$g1:" || fail=1 +chgrp -R $g2 d ||fail=1; test $(stat --p=%g: $d_files) = "$g2:$g2:" || fail=1 +chgrp -R $g1 d ||fail=1; test $(stat --p=%g: $d_files) = "$g1:$g1:" || fail=1 +chgrp -R $g2 d ||fail=1; test $(stat --p=%g: $d_files) = "$g2:$g2:" || fail=1 +chgrp -R $g1 d ||fail=1; test $(stat --p=%g: $d_files) = "$g1:$g1:" || fail=1 +chgrp $g2 d ||fail=1; test $(stat --p=%g: $d_files) = "$g2:$g1:" || fail=1 rm -f f touch f ln -s f symlink chgrp $g1 f -test `stat --printf=%g f` = $g1 || fail=1 +test $(stat --printf=%g f) = $g1 || fail=1 # This should not change the group of f. chgrp -h $g2 symlink -test `stat --printf=%g f` = $g1 || fail=1 +test $(stat --printf=%g f) = $g1 || fail=1 # Don't fail if chgrp failed to set the group of a symlink. # Some systems don't support that. -test `stat --printf=%g symlink` = $g2 || +test $(stat --printf=%g symlink) = $g2 || echo 'info: failed to set group of symlink' 1>&2 -chown --from=:$g1 :$g2 f; test `stat --printf=%g f` = $g2 || fail=1 +chown --from=:$g1 :$g2 f; test $(stat --printf=%g f) = $g2 || fail=1 # This *should* change the group of f. # Though note that the diagnostic is misleading in that # it says the 'group of 'symlink'' has been changed. -chgrp $g1 symlink; test `stat --printf=%g f` = $g1 || fail=1 -chown --from=:$g1 :$g2 f; test `stat --printf=%g f` = $g2 || fail=1 +chgrp $g1 symlink; test $(stat --printf=%g f) = $g1 || fail=1 +chown --from=:$g1 :$g2 f; test $(stat --printf=%g f) = $g2 || fail=1 # If -R is specified without -H or L, -h is assumed. -chgrp -h $g1 f symlink; test `stat --printf=%g symlink` = $g1 || fail=1 +chgrp -h $g1 f symlink; test $(stat --printf=%g symlink) = $g1 || fail=1 chgrp -R $g2 symlink -chown --from=:$g1 :$g2 f; test `stat --printf=%g f` = $g2 || fail=1 +chown --from=:$g1 :$g2 f; test $(stat --printf=%g f) = $g2 || fail=1 # Make sure we can change the group of inaccessible files. chmod a-r f -chown --from=:$g2 :$g1 f; test `stat --printf=%g f` = $g1 || fail=1 +chown --from=:$g2 :$g1 f; test $(stat --printf=%g f) = $g1 || fail=1 chmod 0 f -chown --from=:$g1 :$g2 f; test `stat --printf=%g f` = $g2 || fail=1 +chown --from=:$g1 :$g2 f; test $(stat --printf=%g f) = $g2 || fail=1 # chown() must not be optimized away even when # the file's owner and group already have the desired value. @@ -96,7 +96,7 @@ chgrp $g1 f # ctime is more recent. This is not a big deal; # this test works fine when the files are on a local file system (/tmp). chgrp '' f -test "`ls -C -c -t f g`" = 'f g' || \ +test "$(ls -C -c -t f g)" = 'f g' || \ { case $host_triplet in *openbsd*) echo ignoring known OpenBSD-specific chgrp failure 1>&2 ;; diff --git a/tests/chgrp/default-no-deref b/tests/chgrp/default-no-deref index d6553077a..5d140a8da 100755 --- a/tests/chgrp/default-no-deref +++ b/tests/chgrp/default-no-deref @@ -26,8 +26,8 @@ g2=$2 mkdir d && touch f && ln -s ../f d/s || framework_failure_ -g_init=`stat --printf=%g f` +g_init=$(stat --printf=%g f) chgrp -R $g2 d || fail=1 -test `stat --printf=%g f` = $g_init || fail=1 +test $(stat --printf=%g f) = $g_init || fail=1 Exit $fail diff --git a/tests/chgrp/deref b/tests/chgrp/deref index 18946b1fa..4c186ee82 100755 --- a/tests/chgrp/deref +++ b/tests/chgrp/deref @@ -28,7 +28,7 @@ touch f ln -s f symlink chgrp -h $g2 symlink 2> /dev/null -set _ `ls -ln symlink` +set _ $(ls -ln symlink) g=$5 test "$g" = $g2 || skip_ "your system doesn't support changing the owner or group" \ @@ -36,25 +36,25 @@ test "$g" = $g2 || chgrp $g1 f -set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln f); g=$5; test "$g" = $g1 || fail=1 chgrp -h $g2 symlink || fail=1 -set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln f); g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln symlink); g=$5; test "$g" = $g2 || fail=1 # This should not change the group of f. chgrp -h $g2 symlink || fail=1 -set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln f); g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln symlink); g=$5; test "$g" = $g2 || fail=1 chgrp $g2 f -set _ `ls -ln f`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln f); g=$5; test "$g" = $g2 || fail=1 # This *should* change the group of f. # Though note that the diagnostic you'd get with -c is misleading in that # it says the 'group of 'symlink'' has been changed. chgrp --dereference $g1 symlink -set _ `ls -ln f`; g=$5; test "$g" = $g1 || fail=1 -set _ `ls -ln symlink`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln f); g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln symlink); g=$5; test "$g" = $g2 || fail=1 Exit $fail diff --git a/tests/chgrp/posix-H b/tests/chgrp/posix-H index a6474f562..3965f1ff5 100755 --- a/tests/chgrp/posix-H +++ b/tests/chgrp/posix-H @@ -46,7 +46,7 @@ for i in $changed; do # Filter out symlinks (entries that end in 's'), since it's not # possible to change their group/owner information on some systems. case $i in *s) continue;; esac - set _ `ls -dgn $i`; shift + set _ $(ls -dgn $i); shift group=$3 test $group = $g2 || fail=1 done @@ -62,7 +62,7 @@ for i in $not_changed; do # Filter out symlinks (entries that end in 's'), since it's not # possible to change their group/owner information on some systems. case $i in *s) continue;; esac - set _ `ls -dgn $i`; shift + set _ $(ls -dgn $i); shift group=$3 test $group = $g1 || fail=1 done diff --git a/tests/chgrp/recurse b/tests/chgrp/recurse index 9f9587bf3..95a910f6c 100755 --- a/tests/chgrp/recurse +++ b/tests/chgrp/recurse @@ -32,22 +32,22 @@ ln -s ../e d/s chgrp -R $g1 e/ee || fail=1 # This should not should change the group of e/ee chgrp -R $g2 d -set _ `ls -ln e/ee`; g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln e/ee); g=$5; test "$g" = $g1 || fail=1 # This must change the group of e/ee, since -L makes # chgrp traverse the symlink from d/s into e. chgrp -L -R $g2 d -set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln e/ee); g=$5; test "$g" = $g2 || fail=1 # This must *not* change the group of e/ee chgrp -H -R $g1 d -set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln e/ee); g=$5; test "$g" = $g2 || fail=1 ln -s d link # This shouldn't change the group of e/ee either. chgrp -H -R $g1 link || fail=1 -set _ `ls -ln e/ee`; g=$5; test "$g" = $g2 || fail=1 +set _ $(ls -ln e/ee); g=$5; test "$g" = $g2 || fail=1 # But it *should* change d/dd. -set _ `ls -ln d/dd`; g=$5; test "$g" = $g1 || fail=1 +set _ $(ls -ln d/dd); g=$5; test "$g" = $g1 || fail=1 Exit $fail diff --git a/tests/chmod/c-option b/tests/chmod/c-option index 9235b52fc..0fc83912a 100755 --- a/tests/chmod/c-option +++ b/tests/chmod/c-option @@ -32,7 +32,7 @@ chmod -c g=rwx $file > out || fail=1 chmod -c g=rwx $file > empty || fail=1 test -s empty && fail=1 -case "`cat out`" in +case "$(cat out)" in "mode of 'f' changed from 0744 "?rwxr--r--?" to 0774 "?rwxrwxr--?) ;; *) cat out; fail=1 ;; esac diff --git a/tests/chmod/equal-x b/tests/chmod/equal-x index d2998d137..e2cac3478 100755 --- a/tests/chmod/equal-x +++ b/tests/chmod/equal-x @@ -25,7 +25,7 @@ touch $file || framework_failure_ umask 005 for mode in =x =xX =Xx =x,=X =X,=x; do chmod a=r,$mode $file || fail=1 - case "`ls -l $file`" in + case "$(ls -l $file)" in ---x--x---*) ;; *) fail=1; echo "after 'chmod $mode $file':"; ls -l $file ;; esac diff --git a/tests/chmod/equals b/tests/chmod/equals index 54c39aedf..fd92055c2 100755 --- a/tests/chmod/equals +++ b/tests/chmod/equals @@ -32,15 +32,15 @@ for src in u g o; do for dest in u g o; do test $dest = $src && continue chmod a=,$src=rwx,$dest=$src,$src= f || fail=1 - actual_perms=`ls -l f|cut -b-10` - expected_perms=`eval 'echo \$expected_'$dest` + actual_perms=$(ls -l f|cut -b-10) + expected_perms=$(eval 'echo $expected_'$dest) test "$actual_perms" = "$expected_perms" || fail=1 done done umask 027 chmod a=,u=rwx,=u f || fail=1 -actual_perms=`ls -l f|cut -b-10` +actual_perms=$(ls -l f|cut -b-10) test "$actual_perms" = "-rwxr-x---" || fail=1 Exit $fail diff --git a/tests/chmod/setgid b/tests/chmod/setgid index 081c36e0d..7fc6db214 100755 --- a/tests/chmod/setgid +++ b/tests/chmod/setgid @@ -31,7 +31,7 @@ chmod g+s d 2> /dev/null && env -- test -g d || # to which you belong. When that happens, the above chmod fails. So # here, upon failure, we try to set the group, then rerun the chmod command. - id_g=`id -g` && + id_g=$(id -g) && test -n "$id_g" && chgrp "$id_g" d && chmod g+s d || framework_failure_ @@ -52,7 +52,7 @@ do expected_mode=drwxr-xr-x ;; *) expected_mode=drwxr-sr-x ;; esac - ls_output=`ls -ld d` + ls_output=$(ls -ld d) case $ls_output in $expected_mode*) ;; *) fail=1 ;; diff --git a/tests/chmod/usage b/tests/chmod/usage index 3a4d1b82a..9dd65f7cc 100755 --- a/tests/chmod/usage +++ b/tests/chmod/usage @@ -54,15 +54,15 @@ cases=' ug,+x f : ' -all_files=`echo "$cases" | sed 's/.*://'|sort -u` +all_files=$(echo "$cases" | sed 's/.*://'|sort -u) old_IFS=$IFS IFS=' ' for case in $cases; do IFS=$old_IFS - args=`expr "$case" : ' *\(.*[^ ]\) *:'` - files=`expr "$case" : '.*: *\(.*\)'` + args=$(expr "$case" : ' *\(.*[^ ]\) *:') + files=$(expr "$case" : '.*: *\(.*\)') case $files in '') diff --git a/tests/chown/basic b/tests/chown/basic index 98145dac1..7c8951c83 100755 --- a/tests/chown/basic +++ b/tests/chown/basic @@ -25,12 +25,12 @@ touch f || framework_failure_ chown -R --preserve-root 0:1 f # Make sure the owner and group are 0 and 1 respectively. -set _ `ls -n f`; shift; test "$3:$4" = 0:1 || fail=1 +set _ $(ls -n f); shift; test "$3:$4" = 0:1 || fail=1 # Make sure the correct diagnostic is output # Note we output a name even though an id was specified. chown -v --from=42 43 f > out || fail=1 -printf "ownership of 'f' retained as `id -nu`\n" > exp +printf "ownership of 'f' retained as $(id -nu)\n" > exp compare exp out || fail=1 # Ensure diagnostics work for non existent files. @@ -41,19 +41,19 @@ compare exp out || fail=1 chown --from=0:1 2:010 f || fail=1 # And now they should be 2 and 10 respectively. -set _ `ls -n f`; shift; test "$3:$4" = 2:10 || fail=1 +set _ $(ls -n f); shift; test "$3:$4" = 2:10 || fail=1 ln -s f slink # Applying chown to a symlink with --no-dereference # should change only the link. chown --no-dereference 0:1 slink || fail=1 # owner/group on the symlink should be set -set _ `ls -n slink`; shift; test "$3:$4" = 0:1 || fail=1 +set _ $(ls -n slink); shift; test "$3:$4" = 0:1 || fail=1 # owner/group on the referent should remain unchanged -set _ `ls -n f`; shift; test "$3:$4" = 2:10 || fail=1 +set _ $(ls -n f); shift; test "$3:$4" = 2:10 || fail=1 chown --no-dereference --from=0:1 2:010 slink || fail=1 # owner/group on the symlink should be changed -set _ `ls -n slink`; shift; test "$3:$4" = 2:10 || fail=1 +set _ $(ls -n slink); shift; test "$3:$4" = 2:10 || fail=1 Exit $fail diff --git a/tests/chown/deref b/tests/chown/deref index 9ba28062e..d42a05412 100755 --- a/tests/chown/deref +++ b/tests/chown/deref @@ -23,7 +23,7 @@ print_ver_ chown ln -s no-such dangle || framework_failure_ -set _ `ls -ldo dangle`; shift; user=$3 +set _ $(ls -ldo dangle); shift; user=$3 # With 5.2.1 and earlier, this command would mistakenly succeed. chown --dereference $user dangle 2> out1 && fail=1 diff --git a/tests/chown/preserve-root b/tests/chown/preserve-root index a9145b7ab..ffad22228 100755 --- a/tests/chown/preserve-root +++ b/tests/chown/preserve-root @@ -38,13 +38,13 @@ chmod -R --preserve-root u+r / >> out 2>&1 && fail=1 # since the symlink in question is not a command line argument. # Contrary to the above commands, these two should succeed. echo '==== test -RHh' >> out -chown -RHh --preserve-root `id -u` d >> out 2>&1 || fail=1 -chgrp -RHh --preserve-root `id -g` d >> out 2>&1 || fail=1 +chown -RHh --preserve-root $(id -u) d >> out 2>&1 || fail=1 +chgrp -RHh --preserve-root $(id -g) d >> out 2>&1 || fail=1 # These must fail. echo '==== test -RLh' >> out -chown -RLh --preserve-root `id -u` d >> out 2>&1 && fail=1 -chgrp -RLh --preserve-root `id -g` d >> out 2>&1 && fail=1 +chown -RLh --preserve-root $(id -u) d >> out 2>&1 && fail=1 +chgrp -RLh --preserve-root $(id -g) d >> out 2>&1 && fail=1 cat <<\EOF > exp || fail=1 chown: it is dangerous to operate recursively on '/' diff --git a/tests/chown/separator b/tests/chown/separator index 6295fd78f..d4264a8c8 100755 --- a/tests/chown/separator +++ b/tests/chown/separator @@ -19,16 +19,16 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ chown -id_u=`id -u` || framework_failure_ +id_u=$(id -u) || framework_failure_ test -n "$id_u" || framework_failure_ -id_un=`id -un` || framework_failure_ +id_un=$(id -un) || framework_failure_ test -n "$id_un" || framework_failure_ -id_g=`id -g` || framework_failure_ +id_g=$(id -g) || framework_failure_ test -n "$id_g" || framework_failure_ -id_gn=`id -gn` || framework_failure_ +id_gn=$(id -gn) || framework_failure_ test -n "$id_gn" || framework_failure_ # FreeBSD 6.x's getgrnam fails to look up a group name containing diff --git a/tests/cp/acl b/tests/cp/acl index 94b7af69b..26a7f420a 100755 --- a/tests/cp/acl +++ b/tests/cp/acl @@ -31,22 +31,22 @@ touch a/file || framework_failure_ # Ensure that setfacl and getfacl work on this file system. skip=no -acl1=`cd a && getfacl file` || skip=yes +acl1=$(cd a && getfacl file) || skip=yes setfacl -m user:bin:rw- a/file 2> /dev/null || skip=yes test $skip = yes && skip_ "'.' is not on a suitable file system for this test" # copy a file without preserving permissions cp a/file b/ || fail=1 -acl2=`cd b && getfacl file` || framework_failure_ +acl2=$(cd b && getfacl file) || framework_failure_ test "$acl1" = "$acl2" || fail=1 # Update with acl set above -acl1=`cd a && getfacl file` || framework_failure_ +acl1=$(cd a && getfacl file) || framework_failure_ # copy a file, preserving permissions cp -p a/file b/ || fail=1 -acl2=`cd b && getfacl file` || framework_failure_ +acl2=$(cd b && getfacl file) || framework_failure_ test "$acl1" = "$acl2" || fail=1 # copy a file, preserving permissions, with --attributes-only @@ -54,7 +54,7 @@ echo > a/file || framework_failure_ # add some data test -s a/file || framework_failure_ cp -p --attributes-only a/file b/ || fail=1 test -s b/file && fail=1 -acl2=`cd b && getfacl file` || framework_failure_ +acl2=$(cd b && getfacl file) || framework_failure_ test "$acl1" = "$acl2" || fail=1 Exit $fail diff --git a/tests/cp/cp-a-selinux b/tests/cp/cp-a-selinux index 11758170d..b85298488 100755 --- a/tests/cp/cp-a-selinux +++ b/tests/cp/cp-a-selinux @@ -24,7 +24,7 @@ print_ver_ cp require_root_ require_selinux_ -cwd=`pwd` +cwd=$(pwd) cleanup_() { cd /; umount "$cwd/mnt"; } # This context is special: it works even when mcstransd isn't running. diff --git a/tests/cp/cp-mv-backup b/tests/cp/cp-mv-backup index 3e6b6ff90..030f722dc 100755 --- a/tests/cp/cp-mv-backup +++ b/tests/cp/cp-mv-backup @@ -35,7 +35,7 @@ for prog in cp mv; do for opt in none off numbered t existing nil simple never; do touch $initial_files $prog --backup=$opt x y || fail=1 - echo $initial_files $opt: `ls [xy]*`; rm -f x y y~ y.~?~ + echo $initial_files $opt: $(ls [xy]*); rm -f x y y~ y.~?~ done done done diff --git a/tests/cp/cp-mv-enotsup-xattr b/tests/cp/cp-mv-enotsup-xattr index 76ede2e3e..66e54cf11 100755 --- a/tests/cp/cp-mv-enotsup-xattr +++ b/tests/cp/cp-mv-enotsup-xattr @@ -23,7 +23,7 @@ print_ver_ cp mv require_root_ -cwd=`pwd` +cwd=$(pwd) cleanup_() { cd /; umount "$cwd/noxattr"; umount "$cwd/xattr"; } skip=0 diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents index 85fccd63b..b325c722b 100755 --- a/tests/cp/cp-parents +++ b/tests/cp/cp-parents @@ -49,10 +49,10 @@ test -d d/f && fail=1 chmod go=w d/a || framework_failure_ cp -a --parents d/a/b/c e || fail=1 cp -a --parents sym/b/c g || fail=1 -p=`ls -ld e/d|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac -p=`ls -ld e/d/a|cut -b-10`; case $p in drwx-w--w-);; *) fail=1;; esac -p=`ls -ld g/sym|cut -b-10`; case $p in drwx-w--w-);; *) fail=1;; esac -p=`ls -ld e/d/a/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac -p=`ls -ld g/sym/b/c|cut -b-10`; case $p in drwxr-xr-x);; *) fail=1;; esac +p=$(ls -ld e/d|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac +p=$(ls -ld e/d/a|cut -b-10); case $p in drwx-w--w-);; *) fail=1;; esac +p=$(ls -ld g/sym|cut -b-10); case $p in drwx-w--w-);; *) fail=1;; esac +p=$(ls -ld e/d/a/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac +p=$(ls -ld g/sym/b/c|cut -b-10); case $p in drwxr-xr-x);; *) fail=1;; esac Exit $fail diff --git a/tests/cp/fail-perm b/tests/cp/fail-perm index 3835f6b0f..2c37d6fb1 100755 --- a/tests/cp/fail-perm +++ b/tests/cp/fail-perm @@ -31,7 +31,7 @@ cp -pR D DD > /dev/null 2>&1 && fail=1 # Permissions on DD must be 'dr-x------' -mode=`ls -ld DD|cut -b-10` +mode=$(ls -ld DD|cut -b-10) test "$mode" = dr-x------ || fail=1 chmod 0 D diff --git a/tests/cp/fiemap-empty b/tests/cp/fiemap-empty index efa4b660d..4ba4ee30e 100755 --- a/tests/cp/fiemap-empty +++ b/tests/cp/fiemap-empty @@ -29,7 +29,7 @@ fiemap_capable_ fiemap_chk || skip_ 'this file system lacks FIEMAP support' rm fiemap_chk -# TODO: rather than requiring `fallocate`, possible add +# TODO: rather than requiring $(fallocate), possible add # this functionality to truncate --alloc fallocate --help >/dev/null || skip_ 'The fallocate utility is required' fallocate -l 1 -n falloc.test || diff --git a/tests/cp/file-perm-race b/tests/cp/file-perm-race index 46db6f974..fbc9a86eb 100755 --- a/tests/cp/file-perm-race +++ b/tests/cp/file-perm-race @@ -46,7 +46,7 @@ cp_pid=$! echo foo ) >fifo -case `cat ls.out` in +case $(cat ls.out) in -???------*) ;; *) fail=1;; esac diff --git a/tests/cp/link-preserve b/tests/cp/link-preserve index 785c9e40a..9ca1705f5 100755 --- a/tests/cp/link-preserve +++ b/tests/cp/link-preserve @@ -28,8 +28,8 @@ test -f c/a || framework_failure_ test -f c/b || framework_failure_ -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- @@ -38,8 +38,8 @@ touch a ln -s a b mkdir c cp --preserve=links -R -H a b c -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- @@ -47,24 +47,24 @@ test "$a_inode" = "$b_inode" || fail=1 # and translates to hard-linked a and b in the destination dir. rm -rf a b c d; mkdir d; (cd d; touch a; ln -s a b) cp --preserve=links -R -L d c -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- # Same as above, but starting with a/b hard linked. rm -rf a b c d; mkdir d; (cd d; touch a; ln a b) cp --preserve=links -R -L d c -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- # Ensure that --no-preserve=links works. rm -rf a b c d; mkdir d; (cd d; touch a; ln a b) cp -dR --no-preserve=links d c -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" && fail=1 # -------------------------------------- @@ -73,8 +73,8 @@ rm -rf a b c d touch a; ln a b mkdir c cp -d a b c -a_inode=`ls -i c/a|sed 's,c/.*,,'` -b_inode=`ls -i c/b|sed 's,c/.*,,'` +a_inode=$(ls -i c/a|sed 's,c/.*,,') +b_inode=$(ls -i c/b|sed 's,c/.*,,') test "$a_inode" = "$b_inode" || fail=1 # -------------------------------------- @@ -83,7 +83,7 @@ rm -rf a b c d touch a; chmod 731 a umask 077 cp -a --no-preserve=mode a b -mode=`ls -l b|cut -b-10` +mode=$(ls -l b|cut -b-10) test "$mode" = "-rwx------" || fail=1 umask 022 # -------------------------------------- diff --git a/tests/cp/link-symlink b/tests/cp/link-symlink index 97fbf4b9b..57bc9c715 100755 --- a/tests/cp/link-symlink +++ b/tests/cp/link-symlink @@ -25,7 +25,7 @@ touch file ln -s file link || framework_failure_ touch -m -h -d 2011-01-01 link || skip_ "Your system doesn't support updating symlink timestamps" -case `stat --format=%y link` in +case $(stat --format=%y link) in 2011-01-01*) ;; *) skip_ "Your system doesn't support updating symlink timestamps" ;; esac @@ -33,7 +33,7 @@ esac # link.cp is probably a hardlink, but may also be a symlink # In either case the timestamp should match the original. cp -al link link.cp -case `stat --format=%y link.cp` in +case $(stat --format=%y link.cp) in 2011-01-01*) ;; *) fail=1 ;; esac diff --git a/tests/cp/no-deref-link1 b/tests/cp/no-deref-link1 index 8600b8e0a..c2a565793 100755 --- a/tests/cp/no-deref-link1 +++ b/tests/cp/no-deref-link1 @@ -34,6 +34,6 @@ cp -d a/foo b 2>/dev/null # Fail this test if the exit status is not 1 test $? = 1 || fail=1 -test "`cat a/foo`" = $msg || fail=1 +test "$(cat a/foo)" = $msg || fail=1 Exit $fail diff --git a/tests/cp/no-deref-link2 b/tests/cp/no-deref-link2 index 96d444fdf..584029954 100755 --- a/tests/cp/no-deref-link2 +++ b/tests/cp/no-deref-link2 @@ -34,6 +34,6 @@ cp -d a b 2>/dev/null # Fail this test if the exit status is not 1 test $? = 1 || fail=1 -test "`cat a`" = $msg || fail=1 +test "$(cat a)" = $msg || fail=1 Exit $fail diff --git a/tests/cp/no-deref-link3 b/tests/cp/no-deref-link3 index 629f2ae8d..5f63f2699 100755 --- a/tests/cp/no-deref-link3 +++ b/tests/cp/no-deref-link3 @@ -31,6 +31,6 @@ cp -d a b 2>/dev/null # Fail this test if the exit status is not 1 test $? = 1 || fail=1 -test "`cat a`" = $msg || fail=1 +test "$(cat a)" = $msg || fail=1 Exit $fail diff --git a/tests/cp/parent-perm-race b/tests/cp/parent-perm-race index 4eb79bb47..41486fcb1 100755 --- a/tests/cp/parent-perm-race +++ b/tests/cp/parent-perm-race @@ -48,7 +48,7 @@ do echo foo ) >$attr/fifo - ls_output=`cat d/$attr.ls` || fail=1 + ls_output=$(cat d/$attr.ls) || fail=1 case $attr,$ls_output in ownership,d???--[-S]--[-S]* | \ mode,d????-??-?* | \ diff --git a/tests/cp/perm b/tests/cp/perm index 2e6126d62..eb3925da2 100755 --- a/tests/cp/perm +++ b/tests/cp/perm @@ -49,8 +49,8 @@ for u in 31 37 2; do case "$cmd:$force:$existing_dest" in cp:*:yes) - _g_perm=`echo rwx|sed 's/[^'$g_perm']/-/g'` - _o_perm=`echo rwx|sed 's/[^'$o_perm']/-/g'` + _g_perm=$(echo rwx|sed 's/[^'$g_perm']/-/g') + _o_perm=$(echo rwx|sed 's/[^'$o_perm']/-/g') expected_perms=-rw-$_g_perm$_o_perm ;; cp:*:no) diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid index 355db4d87..6f371c3fb 100755 --- a/tests/cp/preserve-gid +++ b/tests/cp/preserve-gid @@ -39,7 +39,7 @@ t0() { g=$1; shift rm -f b || exit 1 "$@" "$f" b || exit 1 - s=`stat -c '%u %g' b` + s=$(stat -c '%u %g' b) if test "x$s" != "x$u $g"; then # Allow the actual group to match that of the parent directory # (it was set to 0 above). diff --git a/tests/cp/preserve-link b/tests/cp/preserve-link index df1d8c53f..5f069af7c 100755 --- a/tests/cp/preserve-link +++ b/tests/cp/preserve-link @@ -68,7 +68,7 @@ create_target_tree() # Note we repeat this, creating either one of # two hard linked files from source in the dest, so as to -# test both paths in `cp` for creating the hard links. +# test both paths in $(cp) for creating the hard links. # The path taken by cp is dependent on which cp encounters # first in the source, which is non deterministic currently # (I'm guessing that results are sorted by inode and diff --git a/tests/cp/r-vs-symlink b/tests/cp/r-vs-symlink index 15616ffd7..e96c58425 100755 --- a/tests/cp/r-vs-symlink +++ b/tests/cp/r-vs-symlink @@ -32,7 +32,7 @@ ln -s no-such-file no-file || framework_failure_ cp -r no-file junk 2>/dev/null || fail=1 cp -r slink bar 2>/dev/null || fail=1 -set x `ls -l bar`; shift; mode=$1 +set x $(ls -l bar); shift; mode=$1 case $mode in l*) ;; *) fail=1;; diff --git a/tests/cp/same-file b/tests/cp/same-file index d5abfe82b..dbd4d01b6 100755 --- a/tests/cp/same-file +++ b/tests/cp/same-file @@ -111,7 +111,7 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2' 'foo hardlink'; do # the destination is a copy. for f in $args; do if test -f $f; then - case "`cat $f`" in + case "$(cat $f)" in "$contents") ;; *) echo cp FAILED;; esac diff --git a/tests/cp/sparse b/tests/cp/sparse index f1633ae0e..a55202877 100755 --- a/tests/cp/sparse +++ b/tests/cp/sparse @@ -24,14 +24,14 @@ require_sparse_support_ # It has to be at least 128K in order to be sparse on some systems. # Make its size one larger than 128K, in order to tickle the # bug in coreutils-6.0. -size=`expr 128 \* 1024 + 1` +size=$(expr 128 \* 1024 + 1) dd bs=1 seek=$size of=sparse < /dev/null 2> /dev/null || framework_failure_ cp --sparse=always sparse copy || fail=1 # Ensure that the copy has the same block count as the original. -test `stat --printf %b copy` -le `stat --printf %b sparse` || fail=1 +test $(stat --printf %b copy) -le $(stat --printf %b sparse) || fail=1 # Ensure that --sparse={always,never} with --reflink fail. cp --sparse=always --reflink sparse copy && fail=1 diff --git a/tests/cp/special-bits b/tests/cp/special-bits index 40795104c..4a00891d9 100755 --- a/tests/cp/special-bits +++ b/tests/cp/special-bits @@ -33,18 +33,18 @@ chmod u=rwx,g=rx,o=rx . || framework_failure_ cp -p a a2 || fail=1 -set _ `ls -l a`; shift; p1=$1 -set _ `ls -l a2`; shift; p2=$1 +set _ $(ls -l a); shift; p1=$1 +set _ $(ls -l a2); shift; p2=$1 test $p1 = $p2 || fail=1 cp -p b b2 || fail=1 -set _ `ls -l b`; shift; p1=$1 -set _ `ls -l b2`; shift; p2=$1 +set _ $(ls -l b); shift; p1=$1 +set _ $(ls -l b2); shift; p2=$1 test $p1 = $p2 || fail=1 setuidgid $NON_ROOT_USERNAME env PATH="$PATH" cp -p c c2 || fail=1 -set _ `ls -l c`; shift; p1=$1 -set _ `ls -l c2`; shift; p2=$1 +set _ $(ls -l c); shift; p1=$1 +set _ $(ls -l c2); shift; p2=$1 test $p1 = $p2 && fail=1 Exit $fail diff --git a/tests/cp/symlink-slash b/tests/cp/symlink-slash index 0b32b9536..95c9cfa04 100755 --- a/tests/cp/symlink-slash +++ b/tests/cp/symlink-slash @@ -24,7 +24,7 @@ mkdir dir || framework_failure_ ln -s dir symlink || framework_failure_ cp -dR symlink/ s || fail=1 -set `ls -l s` +set $(ls -l s) # Prior to fileutils-4.0q, the following would have output ...'s -> dir' # because the trailing slash was removed unconditionally (now you have to diff --git a/tests/dd/bytes b/tests/dd/bytes index 15755aae3..2d40f0641 100755 --- a/tests/dd/bytes +++ b/tests/dd/bytes @@ -21,7 +21,7 @@ print_ver_ dd # count_bytes echo 0123456789abcdefghijklm > in || framework_failure_ dd count=14 conv=swab iflag=count_bytes < in > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in 1032547698badc) ;; *) fail=1 ;; esac @@ -29,7 +29,7 @@ esac # skip_bytes echo 0123456789abcdefghijklm > in || framework_failure_ dd skip=10 iflag=skip_bytes < in > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in abcdefghijklm) ;; *) fail=1 ;; esac @@ -37,7 +37,7 @@ esac # skip records and bytes from pipe echo 0123456789abcdefghijklm | dd skip=10 bs=2 iflag=skip_bytes > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in abcdefghijklm) ;; *) fail=1 ;; esac diff --git a/tests/dd/misc b/tests/dd/misc index aad04dcb1..52a5b2081 100755 --- a/tests/dd/misc +++ b/tests/dd/misc @@ -57,10 +57,10 @@ if dd iflag=directory if=. count=0 2> /dev/null; then dd iflag=directory count=0 <$tmp_in 2> /dev/null && fail=1 fi -old_ls=`ls -u --full-time $tmp_in` +old_ls=$(ls -u --full-time $tmp_in) sleep 1 if dd iflag=noatime if=$tmp_in of=$tmp_out 2> /dev/null; then - new_ls=`ls -u --full-time $tmp_in` + new_ls=$(ls -u --full-time $tmp_in) if test "x$old_ls" != "x$new_ls"; then cat >&2 < /dev/null; then dd oflag=nolinks < $tmp_in > $tmp_out 2>&1 || fail=1 fi -outbytes=`echo x | dd bs=3 ibs=10 obs=10 conv=sync 2>/dev/null | wc -c` +outbytes=$(echo x | dd bs=3 ibs=10 obs=10 conv=sync 2>/dev/null | wc -c) test "$outbytes" -eq 3 || fail=1 # A delay is required to trigger a failure. diff --git a/tests/dd/not-rewound b/tests/dd/not-rewound index 284dd4a1a..5364f907f 100755 --- a/tests/dd/not-rewound +++ b/tests/dd/not-rewound @@ -23,7 +23,7 @@ print_ver_ dd echo abcde > in (dd skip=1 count=1 bs=1; dd skip=1 bs=1) < in > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in bde) ;; *) fail=1 ;; esac diff --git a/tests/dd/skip-seek2 b/tests/dd/skip-seek2 index e1d3edb41..7f5e0560f 100755 --- a/tests/dd/skip-seek2 +++ b/tests/dd/skip-seek2 @@ -23,14 +23,14 @@ print_ver_ dd echo LA:3456789abcdef > in || fail=1 (dd bs=1 skip=3 count=0 && dd bs=5) < in > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in 3456789abcdef) ;; *) fail=1 ;; esac echo LA:3456789abcdef > in || fail=1 (dd bs=1 skip=3 count=0 && dd bs=5 count=2) < in > out 2> /dev/null || fail=1 -case `cat out` in +case $(cat out) in 3456789abc) ;; *) fail=1 ;; esac diff --git a/tests/du/2g b/tests/du/2g index a901ddbe9..96cf62d7c 100755 --- a/tests/du/2g +++ b/tests/du/2g @@ -30,7 +30,7 @@ very_expensive_ # This technique relies on the fact that the 'Available' kilobyte # count is the number just before the one with a trailing '%'. -free_kb=`df -kP .|tail -1|sed 's/ [0-9][0-9]*%.*//;s/ *$//;s/.* //'` +free_kb=$(df -kP .|tail -1|sed 's/ [0-9][0-9]*%.*//;s/ *$//;s/.* //') case "$free_kb" in [0-9]*) ;; *) skip_ "invalid size from df: $free_kb";; @@ -47,7 +47,7 @@ test $min_kb -lt $free_kb || big=big rm -f $big test -t 1 || printf 'creating a 2GB file...\n' -for i in `seq 100`; do +for i in $(seq 100); do # Note: 2147483648 == 2^31. Print floor(2^31/100) per iteration. printf %21474836s x >> $big || fail=1 # On the final iteration, append the remaining 48 bytes. diff --git a/tests/du/8gb b/tests/du/8gb index 2028d90a0..556423e3c 100755 --- a/tests/du/8gb +++ b/tests/du/8gb @@ -32,7 +32,7 @@ fi # the 'dd' command above mistakenly creates a file of length '0', yet # doesn't fail. The root of that failure is that the ftruncate call # returns zero but doesn't do its job. Detect this failure. -set x `ls -gG big` +set x $(ls -gG big) size=$4 if test "$size" = 0; then skip_ "cannot create a file large enough for this test diff --git a/tests/du/basic b/tests/du/basic index bb0980eee..d8acf6420 100755 --- a/tests/du/basic +++ b/tests/du/basic @@ -29,7 +29,7 @@ printf %4096s x > d/1 cp d/1 d/sub/2 -B=`stat --format=%B a/b/F` +B=$(stat --format=%B a/b/F) du --block-size=$B -a a > out || fail=1 echo === >> out @@ -37,11 +37,11 @@ du --block-size=$B -a -S a >> out || fail=1 echo === >> out du --block-size=$B -s a >> out || fail=1 -f=`stat --format=%b a/b/F` -b=`stat --format=%b a/b` -a=`stat --format=%b a` -bf=`expr $b + $f` -tot=`expr $bf + $a` +f=$(stat --format=%b a/b/F) +b=$(stat --format=%b a/b) +a=$(stat --format=%b a) +bf=$(expr $b + $f) +tot=$(expr $bf + $a) cat < exp $f a/b/F @@ -65,13 +65,13 @@ if is_local_dir_ .; then echo === >> out du --block-size=$B -S d | sort -r -k2,2 >> out || fail=1 - t2=`stat --format=%b d/sub/2` - ts=`stat --format=%b d/sub` - t1=`stat --format=%b d/1` - td=`stat --format=%b d` - tot=`expr $t1 + $t2 + $ts + $td` - d1=`expr $td + $t1` - s2=`expr $ts + $t2` + t2=$(stat --format=%b d/sub/2) + ts=$(stat --format=%b d/sub) + t1=$(stat --format=%b d/1) + td=$(stat --format=%b d) + tot=$(expr $t1 + $t2 + $ts + $td) + d1=$(expr $td + $t1) + s2=$(expr $ts + $t2) cat < exp $t2 d/sub/2 diff --git a/tests/du/deref b/tests/du/deref index bf2ead4d7..90b765039 100755 --- a/tests/du/deref +++ b/tests/du/deref @@ -39,9 +39,9 @@ du -L dangle > /dev/null 2>&1 && fail=1 # du -L used to mess up, either by counting the symlink's disk space itself # (-L should follow symlinks, not count their space) # or (briefly in July 2010) by omitting the entry for "a". -du_L_output=`du -L a` || fail=1 -du_lL_output=`du -lL a` || fail=1 -du_x_output=`du --exclude=dotdot a` || fail=1 +du_L_output=$(du -L a) || fail=1 +du_lL_output=$(du -lL a) || fail=1 +du_x_output=$(du --exclude=dotdot a) || fail=1 test "X$du_L_output" = "X$du_x_output" || fail=1 test "X$du_lL_output" = "X$du_x_output" || fail=1 diff --git a/tests/du/inaccessible-cwd b/tests/du/inaccessible-cwd index 39e62584d..bfc8cf92e 100755 --- a/tests/du/inaccessible-cwd +++ b/tests/du/inaccessible-cwd @@ -29,7 +29,7 @@ require_openat_support_ skip_if_root_ -cwd=`pwd` +cwd=$(pwd) mkdir -p no-x a/b || framework_failure_ cd no-x || framework_failure_ chmod 0 . || framework_failure_ diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable index 10864e00e..7fc129c17 100755 --- a/tests/du/long-from-unreadable +++ b/tests/du/long-from-unreadable @@ -36,11 +36,11 @@ if test ! -d $proc_file; then skip_ 'This test would fail, since your system lacks /proc support.' fi -dir=`printf '%200s\n' ' '|tr ' ' x` +dir=$(printf '%200s\n' ' '|tr ' ' x) # Construct a hierarchy containing a relative file with a name # longer than PATH_MAX. -# for i in `seq 52`; do +# for i in $(seq 52); do # mkdir $dir || framework_failure_ # cd $dir || framework_failure_ # done @@ -51,7 +51,7 @@ dir=`printf '%200s\n' ' '|tr ' ' x` # cannot access parent directories: # (all on one line). -cwd=`pwd` +cwd=$(pwd) # Use perl instead: : ${PERL=perl} $PERL \ diff --git a/tests/du/long-sloop b/tests/du/long-sloop index 78926d38f..f9e70ad00 100755 --- a/tests/du/long-sloop +++ b/tests/du/long-sloop @@ -29,11 +29,11 @@ print_ver_ du # in a single directory. n=400 -dir_list=`seq $n` +dir_list=$(seq $n) mkdir $dir_list || framework_failure_ file=1 i_minus_1=0 -for i in $dir_list `expr $n + 1`; do +for i in $dir_list $(expr $n + 1); do case $i_minus_1 in 0) ;; *) @@ -56,7 +56,7 @@ echo foo > $i cat $file > /dev/null 2> err && skip_ 'Your system appears to be able to handle more than $n symlinks in file name resolution' -too_many=`sed 's/.*: //' err` +too_many=$(sed 's/.*: //' err) # With coreutils-5.93 there was no failure. diff --git a/tests/du/slink b/tests/du/slink index 1f8429171..674e6a224 100755 --- a/tests/du/slink +++ b/tests/du/slink @@ -32,7 +32,7 @@ fi symlink_name_lengths='1 15 16 31 32 59 60 63 64 127 128 255 256 511 512 1024' for len in $symlink_name_lengths; do - name=`seq 1 $len|tr -c x y |head -c$len` + name=$(seq 1 $len|tr -c x y |head -c$len) # Record the names of symlinks that are successfully created. ln -fs $name $len > /dev/null 2>&1 \ && symlinks="$symlinks $len" diff --git a/tests/init.cfg b/tests/init.cfg index 17713d924..7bcd512a3 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -235,9 +235,9 @@ rwx_to_mode_() s='s/S/@/;s/s/x@/;s/@/s/' t='s/T/@/;s/t/x@/;s/@/t/' - u=`echo $rwx|sed 's/^.\(...\).*/,u=\1/;s/-//g;s/^,u=$//;'$s` - g=`echo $rwx|sed 's/^....\(...\).*/,g=\1/;s/-//g;s/^,g=$//;'$s` - o=`echo $rwx|sed 's/^.......\(...\).*/,o=\1/;s/-//g;s/^,o=$//;'$s';'$t` + u=$(echo $rwx|sed 's/^.\(...\).*/,u=\1/;s/-//g;s/^,u=$//;'$s) + g=$(echo $rwx|sed 's/^....\(...\).*/,g=\1/;s/-//g;s/^,g=$//;'$s) + o=$(echo $rwx|sed 's/^.......\(...\).*/,o=\1/;s/-//g;s/^,o=$//;'$s';'$t) echo "=$u$g$o" } @@ -259,7 +259,7 @@ require_selinux_() # Independent of whether SELinux is enabled system-wide, # the current file system may lack SELinux support. - case `ls -Zd .` in + case $(ls -Zd .) in '? .'|'unlabeled .') skip_ "this system (or maybe just" \ "the current file system) lacks SELinux support" @@ -316,7 +316,7 @@ require_membership_in_two_groups_() { test $# = 0 || framework_failure_ - groups=${COREUTILS_GROUPS-`(id -G || /usr/xpg4/bin/id -G) 2>/dev/null`} + groups=${COREUTILS_GROUPS-$( (id -G || /usr/xpg4/bin/id -G) 2>/dev/null)} case "$groups" in *' '*) ;; *) skip_ 'requires membership in two groups @@ -389,7 +389,7 @@ require_sparse_support_() # NTFS requires 128K before a hole appears in a sparse file. t=sparse.$$ dd bs=1 seek=128K of=$t < /dev/null 2> /dev/null - set x `du -sk $t` + set x $(du -sk $t) kb_size=$2 rm -f $t if test $kb_size -ge 128; then @@ -447,7 +447,7 @@ working_umask_or_skip_() umask 022 touch file1 file2 chmod 644 file2 - perms=`ls -l file1 file2 | sed 's/ .*//' | uniq` + perms=$(ls -l file1 file2 | sed 's/ .*//' | uniq) rm -f file1 file2 case $perms in @@ -463,7 +463,7 @@ working_umask_or_skip_() # an initial delay of .1 second and call it at most 6 times # with a max delay of 3.2s (doubled each time), or a total of 6.3s # Note ensure you do _not_ quote the parameter to GNU sleep in -# your function, as it may contain separate values that `sleep` +# your function, as it may contain separate values that sleep # needs to accumulate. retry_delay_() { diff --git a/tests/install/basic-1 b/tests/install/basic-1 index 722a947c0..aa80fcf33 100755 --- a/tests/install/basic-1 +++ b/tests/install/basic-1 @@ -57,7 +57,7 @@ ginstall -s -c -m 555 $dd $dir || fail=1 test -f $dd || fail=1 # Make sure that the destination file has the requested permissions. -mode=`ls -l $dir/$dd|cut -b-10` +mode=$(ls -l $dir/$dd|cut -b-10) test "$mode" = -r-xr-xr-x || fail=1 # These failed in coreutils CVS from 2004-06-25 to 2004-08-11. @@ -72,7 +72,7 @@ test -d newdir3 || fail=1 # This fails because mkdir-p.c's make_dir_parents fails to return to its # initial working directory ($iwd) after creating the first argument, and # hence cannot do anything meaningful with the following relative-named dirs. -iwd=`pwd` +iwd=$(pwd) mkdir sub || fail=1 (cd sub && chmod 0 . && diff --git a/tests/install/trap b/tests/install/trap index 79cea5f7c..e3ccf54ac 100755 --- a/tests/install/trap +++ b/tests/install/trap @@ -24,7 +24,7 @@ print_ver_ ginstall # 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 # Before 2004-04-21, install would infloop, in the 'while (wait...' loop: exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" . diff --git a/tests/ln/hard-to-sym b/tests/ln/hard-to-sym index 044b10c0d..358b93008 100755 --- a/tests/ln/hard-to-sym +++ b/tests/ln/hard-to-sym @@ -30,7 +30,7 @@ ln -s -L -P symlink2 symlink3 || fail=1 # =================================================== # ensure that -L follows symlinks, and overrides -P ln -P -L symlink3 hard-to-a || fail=1 -ls=`ls -lG hard-to-a`x +ls=$(ls -lG hard-to-a)x case "$ls" in *'hard-to-ax') ;; *'hard-to-a -> '*x) fail=1 ;; @@ -40,7 +40,7 @@ esac # =================================================== # ensure that -P links (or at least duplicates) symlinks, and overrides -L ln -L -P symlink3 hard-to-3 || fail=1 -ls=`ls -lG hard-to-3`x +ls=$(ls -lG hard-to-3)x case "$ls" in *'hard-to-3 -> symlink2x') ;; *'hard-to-3x') fail=1 ;; @@ -52,7 +52,7 @@ esac # Create a hard link to a dangling symlink. ln -s /no-such-dir || framework_failure_ ln -L no-such-dir hard-to-dangle 2>err && fail=1 -case `cat err` in +case $(cat err) in *" accessing 'no-such-dir'":*) ;; *) fail=1 ;; esac @@ -63,12 +63,12 @@ ln -P no-such-dir hard-to-dangle || fail=1 mkdir d || framework_failure_ ln -s d link-to-dir || framework_failure_ ln -L link-to-dir hard-to-dir-link 2>err && fail=1 -case `cat err` in +case $(cat err) in *": 'link-to-dir': hard link not allowed for directory"*) ;; *) fail=1 ;; esac ln -P link-to-dir/ hard-to-dir-link 2>err && fail=1 -case `cat err` in +case $(cat err) in *": 'link-to-dir/': hard link not allowed for directory"*) ;; *) fail=1 ;; esac diff --git a/tests/ln/misc b/tests/ln/misc index 09baa2645..4da0eda45 100755 --- a/tests/ln/misc +++ b/tests/ln/misc @@ -91,7 +91,7 @@ rm -rf $d $f $ld || framework_failure_ touch $f || framework_failure_ mkdir $d || framework_failure_ ln -s $d $ld -af=`pwd`/$f +af=$(pwd)/$f ln --no-dereference -fs "$af" $ld || fail=1 test -f $ld || fail=1 rm -rf $d $f $ld diff --git a/tests/ln/sf-1 b/tests/ln/sf-1 index e7b680b5d..824c22432 100755 --- a/tests/ln/sf-1 +++ b/tests/ln/sf-1 @@ -23,7 +23,7 @@ echo foo > a || framework_failure_ ln -s . b || framework_failure_ ln -sf a b > err 2>&1 && fail=1 -case `cat err` in +case $(cat err) in *'are the same file') ;; *) fail=1 ;; esac diff --git a/tests/ls/inode b/tests/ls/inode index b5c881e27..8bf5ba153 100755 --- a/tests/ls/inode +++ b/tests/ls/inode @@ -25,17 +25,17 @@ ln -s f slink || framework_failure_ # When listed explicitly: -set x `ls -Ci f slink`; shift +set x $(ls -Ci f slink); shift test $# = 4 || fail=1 # The inode numbers should differ. test "$1" != "$3" || fail=1 -set x `ls -CLi f slink`; shift +set x $(ls -CLi f slink); shift test $# = 4 || fail=1 # With -L, they must be the same. test "$1" = "$3" || fail=1 -set x `ls -CHi f slink`; shift +set x $(ls -CHi f slink); shift test $# = 4 || fail=1 # With -H, they must be the same, too, from the command line. # Note that POSIX says -H must make ls dereference only @@ -47,17 +47,17 @@ test "$1" = "$3" || fail=1 # When listed from a directory: -set x `ls -Ci`; shift +set x $(ls -Ci); shift test $# = 4 || fail=1 # The inode numbers should differ. test "$1" != "$3" || fail=1 -set x `ls -CLi`; shift +set x $(ls -CLi); shift test $# = 4 || fail=1 # With -L, they must be the same. test "$1" = "$3" || fail=1 -set x `ls -CHi`; shift +set x $(ls -CHi); shift test $# = 4 || fail=1 # With -H, they must be different from inside a directory. test "$1" != "$3" || fail=1 diff --git a/tests/ls/nameless-uid b/tests/ls/nameless-uid index 6cd186873..1c8c4718f 100755 --- a/tests/ls/nameless-uid +++ b/tests/ls/nameless-uid @@ -34,7 +34,7 @@ touch f || framework_failure_ chown $nameless_uid f || framework_failure_ -set -- `ls -o f` || fail=1 +set -- $(ls -o f) || fail=1 test $3 = $nameless_uid || fail=1 Exit $fail diff --git a/tests/ls/stat-dtype b/tests/ls/stat-dtype index 733ce38a0..b84d5d51a 100755 --- a/tests/ls/stat-dtype +++ b/tests/ls/stat-dtype @@ -29,7 +29,7 @@ print_ver_ ls # but if ls's d_type code is buggy then "ls -p" might be buggy too. mkdir -p c/d || framework_failure_ chmod a-x c || framework_failure_ -if test "X`ls -p c 2>&1`" != Xd/; then +if test "X$(ls -p c 2>&1)" != Xd/; then skip_ "'.' is not on a suitable file system for this test" fi diff --git a/tests/ls/stat-vs-dirent b/tests/ls/stat-vs-dirent index 60d96220a..1dd6e6621 100755 --- a/tests/ls/stat-vs-dirent +++ b/tests/ls/stat-vs-dirent @@ -20,20 +20,20 @@ print_ver_ ls -root_dev_ino=`stat --format=%d-%i /` -t=`pwd` +root_dev_ino=$(stat --format=%d-%i /) +t=$(pwd) while :; do ls -i1 "$t" > tmp if test $? = 0; then # Extract the inode number from the first line of output from ls -i1. # This value comes from dirent.d_ino, on systems with d_ino support. - d_ino=`sed -n '1s/^ *\([0-9][0-9]*\) .*/\1/p;q' tmp` + d_ino=$(sed -n '1s/^ *\([0-9][0-9]*\) .*/\1/p;q' tmp) # Extract the name of the corresponding directory entry. - file=`sed -n '1s/^ *[0-9][0-9]* *//p;q' tmp` + file=$(sed -n '1s/^ *[0-9][0-9]* *//p;q' tmp) # Get its inode number (stat.st_ino) via stat(1)'s call to lstat. - st_ino=`stat --format=%i "$t/$file"` + st_ino=$(stat --format=%i "$t/$file") # Make sure that they are the same. # We know from experience that there may be mismatches on some @@ -53,7 +53,7 @@ while :; do fi t=$(cd "$t/.."; pwd) - dev_ino=`stat --format=%d-%i "$t"` + dev_ino=$(stat --format=%d-%i "$t") test $dev_ino = $root_dev_ino && break done diff --git a/tests/ls/symlink-slash b/tests/ls/symlink-slash index 4bbf6f79c..28c7d32b2 100755 --- a/tests/ls/symlink-slash +++ b/tests/ls/symlink-slash @@ -22,7 +22,7 @@ print_ver_ ls mkdir dir || framework_failure_ ln -s dir symlink || framework_failure_ -set `ls -l symlink/` +set $(ls -l symlink/) # Prior to fileutils-4.0k, the following would have output '... symlink -> dir'. test "$*" = 'total 0' && : || fail=1 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 <./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 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 diff --git a/tests/mkdir/p-1 b/tests/mkdir/p-1 index a2c41455d..cd8e67606 100755 --- a/tests/mkdir/p-1 +++ b/tests/mkdir/p-1 @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ mkdir -mkdir --parents "`pwd`/t" || fail=1 +mkdir --parents "$(pwd)/t" || fail=1 test -d t || fail=1 Exit $fail diff --git a/tests/mkdir/p-2 b/tests/mkdir/p-2 index 7d1d09501..d0c487ec9 100755 --- a/tests/mkdir/p-2 +++ b/tests/mkdir/p-2 @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ mkdir -mkdir --parents "`pwd`/t/u" || fail=1 +mkdir --parents "$(pwd)/t/u" || fail=1 test -d t/u || fail=1 Exit $fail diff --git a/tests/mkdir/p-3 b/tests/mkdir/p-3 index 90cbd9920..7031b2ede 100755 --- a/tests/mkdir/p-3 +++ b/tests/mkdir/p-3 @@ -26,7 +26,7 @@ mkdir no-access || framework_failure_ mkdir no-acce2s || framework_failure_ mkdir -p no-acce3s/d || framework_failure_ -p=`pwd` +p=$(pwd) (cd no-access && chmod 0 . && mkdir -p "$p/a/b" u/v) 2> /dev/null && fail=1 test -d "$p/a/b" || fail=1 @@ -44,7 +44,7 @@ if is_local_dir_ .; then test -d "$p/b/c" || fail=1 fi -b=`ls "$p/a" | tr -d '\n'` +b=$(ls "$p/a" | tr -d '\n') # With coreutils-5.3.0, this would fail with $b=bu. test "x$b" = xb || fail=1 diff --git a/tests/mkdir/parents b/tests/mkdir/parents index c9bf37bb0..0543e675e 100755 --- a/tests/mkdir/parents +++ b/tests/mkdir/parents @@ -31,21 +31,21 @@ mkdir e-dir > /dev/null 2>&1 && fail=1 # Create an existing directory. umask 077 mode_str=drwxr-x-wx -mode_arg=`rwx_to_mode_ $mode_str` +mode_arg=$(rwx_to_mode_ $mode_str) mkdir -m $mode_arg a || fail=1 # this 'mkdir -p ...' shouldn't change perms of existing dir 'a'. d_mode_str=drwx-w--wx -d_mode_arg=`rwx_to_mode_ $d_mode_str` +d_mode_arg=$(rwx_to_mode_ $d_mode_str) mkdir -p -m $d_mode_arg a/b/c/d # Make sure the permissions of 'a' haven't been changed. -p=`ls -ld a|cut -b-10`; case $p in $mode_str);; *) fail=1;; esac +p=$(ls -ld a|cut -b-10); case $p in $mode_str);; *) fail=1;; esac # 'b's and 'c's should reflect the umask -p=`ls -ld a/b|cut -b-10`; case $p in drwx------);; *) fail=1;; esac -p=`ls -ld a/b/c|cut -b-10`; case $p in drwx------);; *) fail=1;; esac +p=$(ls -ld a/b|cut -b-10); case $p in drwx------);; *) fail=1;; esac +p=$(ls -ld a/b/c|cut -b-10); case $p in drwx------);; *) fail=1;; esac # 'd's perms are determined by the -m argument. -p=`ls -ld a/b/c/d|cut -b-10`; case $p in $d_mode_str);; *) fail=1;; esac +p=$(ls -ld a/b/c/d|cut -b-10); case $p in $d_mode_str);; *) fail=1;; esac Exit $fail diff --git a/tests/mkdir/perm b/tests/mkdir/perm index cabae6cc9..f9b207f81 100755 --- a/tests/mkdir/perm +++ b/tests/mkdir/perm @@ -38,7 +38,7 @@ tests=' 027 : -m =+X : drwxr-x--- : d--x--x--- : - : - : last : last : ' -colon_tests=`echo $tests | sed 's/^ *//; s/ *: */:/g'` +colon_tests=$(echo $tests | sed 's/^ *//; s/ *: */:/g') for p in empty -p; do test _$p = _empty && p= diff --git a/tests/mkdir/special-1 b/tests/mkdir/special-1 index fbf3f1f7b..d478930eb 100755 --- a/tests/mkdir/special-1 +++ b/tests/mkdir/special-1 @@ -26,7 +26,7 @@ tmp=t mkdir -m$set_mode_string $tmp || fail=1 test -d $tmp || fail=1 -mode=`ls -ld $tmp|cut -b-10` +mode=$(ls -ld $tmp|cut -b-10) case "$mode" in $output_mode_string) ;; *) fail=1 ;; @@ -42,7 +42,7 @@ mkdir -m$set_mode_string $tmp2 2> /dev/null && fail=1 mkdir --parents -m$set_mode_string $tmp2 || fail=1 test -d $tmp2 || fail=1 -mode=`ls -ld $tmp2|cut -b-10` +mode=$(ls -ld $tmp2|cut -b-10) case "$mode" in $output_mode_string) ;; *) fail=1 ;; diff --git a/tests/mv/acl b/tests/mv/acl index 382752a33..2354ed967 100755 --- a/tests/mv/acl +++ b/tests/mv/acl @@ -38,30 +38,30 @@ skip_partition=none setfacl -m user:bin:rw- file 2> /dev/null || skip_partition=. # And on the destination file system. setfacl -m user:bin:rw- $t1 || skip_partition=$other_partition_tmpdir -acl1=`getfacl file` || skip_partition=. +acl1=$(getfacl file) || skip_partition=. test $skip_partition != none && skip_ "'$skip_partition' is not on a suitable file system for this test" # move the access acl of a file mv file "$other_partition_tmpdir" || fail=1 -acl2=`cd "$other_partition_tmpdir" && getfacl file` || framework_failure_ +acl2=$(cd "$other_partition_tmpdir" && getfacl file) || framework_failure_ test "$acl1" = "$acl2" || fail=1 # move the access acl of a directory mkdir dir || framework_failure_ setfacl -m user:bin:rw- dir || framework_failure_ -acl1=`getfacl dir` || framework_failure_ +acl1=$(getfacl dir) || framework_failure_ mv dir "$other_partition_tmpdir" || fail=1 -acl2=`cd "$other_partition_tmpdir" && getfacl dir` || framework_failure_ +acl2=$(cd "$other_partition_tmpdir" && getfacl dir) || framework_failure_ test "$acl1" = "$acl2" || fail=1 # move the default acl of a directory mkdir dir2 || framework_failure_ setfacl -d -m user:bin:rw- dir2 || framework_failure_ -acl1=`getfacl dir2` || framework_failure_ +acl1=$(getfacl dir2) || framework_failure_ mv dir2 "$other_partition_tmpdir" || fail=1 -acl2=`cd "$other_partition_tmpdir" && getfacl dir2` || framework_failure_ +acl2=$(cd "$other_partition_tmpdir" && getfacl dir2) || framework_failure_ test "$acl1" = "$acl2" || fail=1 Exit $fail diff --git a/tests/mv/atomic b/tests/mv/atomic index c2b38c690..e5391c337 100755 --- a/tests/mv/atomic +++ b/tests/mv/atomic @@ -41,6 +41,6 @@ $EGREP 'unlink.*"s1"' out && fail=1 ls -dl s1 > /dev/null 2>&1 && fail=1 # Ensure that the destination, s2, contains the link from s1. -test "`readlink s2`" = t1 || fail=1 +test "$(readlink s2)" = t1 || fail=1 Exit $fail diff --git a/tests/mv/atomic2 b/tests/mv/atomic2 index e329dba91..d9c55e2c9 100755 --- a/tests/mv/atomic2 +++ b/tests/mv/atomic2 @@ -39,7 +39,7 @@ $EGREP 'unlink.*"b"' out && fail=1 ls -dl a > /dev/null 2>&1 && fail=1 # Ensure that the destination, "b", has link count 1. -n_links=`stat --printf=%h b` || fail=1 +n_links=$(stat --printf=%h b) || fail=1 test "$n_links" = 1 || fail=1 Exit $fail diff --git a/tests/mv/childproof b/tests/mv/childproof index 04774d294..efe7225d6 100755 --- a/tests/mv/childproof +++ b/tests/mv/childproof @@ -32,7 +32,7 @@ cp a/f b/f c 2> /dev/null && fail=1 test -f a/f || fail=1 test -f b/f || fail=1 test -f c/f || fail=1 -test "`cat c/f`" = a || fail=1 +test "$(cat c/f)" = a || fail=1 rm -f c/f # With --backup=numbered, it should succeed @@ -47,7 +47,7 @@ mv a/f b/f c 2> /dev/null && fail=1 test -f a/f && fail=1 test -f b/f || fail=1 test -f c/f || fail=1 -test "`cat c/f`" = a || fail=1 +test "$(cat c/f)" = a || fail=1 # Make sure mv still works when moving hard links. # This is where the same_file test is necessary, and why @@ -76,8 +76,8 @@ echo a > a/f || fail=1 echo b > b/f || fail=1 ln -f a/f b/f c 2> /dev/null && fail=1 # a/f and c/f must be linked -test `stat --format %i a/f` = `stat --format %i c/f` || fail=1 +test $(stat --format %i a/f) = $(stat --format %i c/f) || fail=1 # b/f and c/f must not be linked -test `stat --format %i b/f` = `stat --format %i c/f` && fail=1 +test $(stat --format %i b/f) = $(stat --format %i c/f) && fail=1 Exit $fail diff --git a/tests/mv/force b/tests/mv/force index 79ff9e95a..6bed83bf9 100755 --- a/tests/mv/force +++ b/tests/mv/force @@ -33,7 +33,7 @@ mv: '$ff' and '$ff' are the same file EOF compare exp out || fail=1 -test `cat $ff` = force-contents || fail=1 +test $(cat $ff) = force-contents || fail=1 # This should succeed, even though the source and destination # device and inodes are the same. diff --git a/tests/mv/hard-2 b/tests/mv/hard-2 index c1d25af0a..e0fc174f0 100755 --- a/tests/mv/hard-2 +++ b/tests/mv/hard-2 @@ -43,9 +43,9 @@ test -f b || fail=1 test -f c || fail=1 # The three i-node numbers must be the same. -ia=`ls -i a|sed 's/ a//'` -ib=`ls -i b|sed 's/ b//'` -ic=`ls -i c|sed 's/ c//'` +ia=$(ls -i a|sed 's/ a//') +ib=$(ls -i b|sed 's/ b//') +ic=$(ls -i c|sed 's/ c//') test $ia = $ib || fail=1 test $ia = $ic || fail=1 @@ -68,9 +68,9 @@ test -f b || fail=1 test -f c || fail=1 # The three i-node numbers must be the same. -ia=`ls -i a|sed 's/ a//'` -ib=`ls -i b|sed 's/ b//'` -ic=`ls -i c|sed 's/ c//'` +ia=$(ls -i a|sed 's/ a//') +ib=$(ls -i b|sed 's/ b//') +ic=$(ls -i c|sed 's/ c//') test $ia = $ib || fail=1 test $ia = $ic || fail=1 diff --git a/tests/mv/hard-3 b/tests/mv/hard-3 index 9dd8ad592..a62167a07 100755 --- a/tests/mv/hard-3 +++ b/tests/mv/hard-3 @@ -58,12 +58,12 @@ test -f x/b || fail=1 test -f c || fail=1 # The i-node numbers of a and c must be the same. -ia=`ls -i a` || fail=1; set x $ia; ia=$2 -ic=`ls -i c` || fail=1; set x $ic; ic=$2 +ia=$(ls -i a) || fail=1; set x $ia; ia=$2 +ic=$(ls -i c) || fail=1; set x $ic; ic=$2 test "$ia" = "$ic" || fail=1 # The i-node number of x/b must be different. -ib=`ls -i x/b` || fail=1; set x $ib; ib=$2 +ib=$(ls -i x/b) || fail=1; set x $ib; ib=$2 test "$ia" = "$ib" && fail=1 Exit $fail diff --git a/tests/mv/hard-link-1 b/tests/mv/hard-link-1 index eccd8bcdb..78a555ac9 100755 --- a/tests/mv/hard-link-1 +++ b/tests/mv/hard-link-1 @@ -34,8 +34,8 @@ mv $dir "$other_partition_tmpdir" || fail=1 ls -1i "$other_partition_tmpdir/$dir" > out || fail=1 # Make sure the inode numbers are the same. -a=`sed -n 's/ a$//p' out` -b=`sed -n 's/ b$//p' out` +a=$(sed -n 's/ a$//p' out) +b=$(sed -n 's/ b$//p' out) test "$a" = "$b" || fail=1 Exit $fail diff --git a/tests/mv/i-2 b/tests/mv/i-2 index 84ccfe58b..f24801958 100755 --- a/tests/mv/i-2 +++ b/tests/mv/i-2 @@ -35,7 +35,7 @@ mv -fi c d < y >/dev/null 2>&1 || fail=1 cp -if e f < y > out 2>&1 || fail=1 # Make sure out contains the prompt. -case "`cat out`" in +case "$(cat out)" in "cp: try to overwrite 'f', overriding mode 0000 (---------)?"*) ;; *) fail=1 ;; esac diff --git a/tests/mv/i-3 b/tests/mv/i-3 index 262b5ba04..3912842a2 100755 --- a/tests/mv/i-3 +++ b/tests/mv/i-3 @@ -45,7 +45,7 @@ mv f g < $tty > out 2>&1 & pid=$! check_overwrite_prompt() { local delay="$1" - case "`cat out`" in + case "$(cat out)" in "mv: try to overwrite 'g', overriding mode 0000"*) ;; *) sleep $delay; return 1;; esac @@ -61,7 +61,7 @@ test -f i || fail=1 test -f h && fail=1 # Make sure there was no prompt. -case "`cat out`" in +case "$(cat out)" in '') ;; *) fail=1 ;; esac diff --git a/tests/mv/i-4 b/tests/mv/i-4 index bcf3fdda2..8ef6ca77b 100755 --- a/tests/mv/i-4 +++ b/tests/mv/i-4 @@ -27,7 +27,7 @@ echo y > y || framework_failure_ mv -i a b < y >/dev/null 2>&1 || fail=1 # Make sure out contains the prompt. -case "`cat b`" in +case "$(cat b)" in a) ;; *) fail=1 ;; esac diff --git a/tests/mv/i-link-no b/tests/mv/i-link-no index a37a1ffba..4615eaabb 100755 --- a/tests/mv/i-link-no +++ b/tests/mv/i-link-no @@ -35,7 +35,7 @@ touch exp_err compare exp out || fail=1 compare exp_err err || fail=1 -case "`cat b/foo`" in +case "$(cat b/foo)" in foo) ;; *) fail=1;; esac diff --git a/tests/mv/leak-fd b/tests/mv/leak-fd index 532bdb082..d349a3f11 100755 --- a/tests/mv/leak-fd +++ b/tests/mv/leak-fd @@ -32,16 +32,16 @@ b="0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z _A _B _C _D _E _F _G _H _I _J _K _L _M _N _O _P _Q _R _S _T _U _V _W _X _Y _Z" -for i in `echo $b`; do +for i in $(echo $b); do echo $i for j in $b; do echo $i$j done done > .dirs -mkdir `cat .dirs` || framework_failure_ +mkdir $(cat .dirs) || framework_failure_ sed 's,$,/f,' .dirs | xargs touch -last_file=`tail -n1 .dirs`/f +last_file=$(tail -n1 .dirs)/f test -f $last_file || framework_failure_ diff --git a/tests/mv/part-hardlink b/tests/mv/part-hardlink index ac71bdf72..af773a23b 100755 --- a/tests/mv/part-hardlink +++ b/tests/mv/part-hardlink @@ -35,9 +35,9 @@ mv f g "$other_partition_tmpdir" || fail=1 mv a b "$other_partition_tmpdir" || fail=1 cd "$other_partition_tmpdir" -set `ls -Ci f g` +set $(ls -Ci f g) test $1 = $3 || fail=1 -set `ls -Ci a/1 b/1` +set $(ls -Ci a/1 b/1) test $1 = $3 || fail=1 Exit $fail diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink index 30cb4400e..2e7cf1b8b 100755 --- a/tests/mv/part-symlink +++ b/tests/mv/part-symlink @@ -27,7 +27,7 @@ cleanup_() { rm -rf "$other_partition_tmpdir"; } # mv: preserving permissions for 'rem_sl': Operation not supported require_local_dir_ -pwd_tmp=`pwd` +pwd_tmp=$(pwd) # Unset CDPATH. Otherwise, output from the 'cd dir' command # can make this test fail. @@ -68,15 +68,15 @@ for copy in cp mv; do rm -f "$other_partition_tmpdir"/* || fail=1 mkdir dir || fail=1 cd dir || fail=1 - case "$args" in *loc_reg*) reg_abs="`pwd`/$loc_reg" ;; esac + case "$args" in *loc_reg*) reg_abs="$(pwd)/$loc_reg" ;; esac case "$args" in *rem_reg*) reg_abs=$rem_reg ;; esac case "$args" in *loc_sl*) slink=$loc_sl ;; esac case "$args" in *rem_sl*) slink=$rem_sl ;; esac echo $contents > "$reg_abs" || fail=1 ln -nsf "$reg_abs" $slink || fail=1 - actual_args=`echo $args|sed 's,^,$,;s/ / $/'` - actual_args=`eval echo $actual_args` + actual_args=$(echo $args|sed 's,^,$,;s/ / $/') + actual_args=$(eval echo $actual_args) ( ( @@ -115,7 +115,7 @@ for copy in cp mv; do for f in $actual_args; do test -f $f || { echo " $copy FAILED but removed $f"; continue; } - case "`cat $f`" in + case "$(cat $f)" in "$contents") ;; *) echo " $copy FAILED but modified $f";; esac @@ -130,7 +130,7 @@ for copy in cp mv; do if test $copy_status != 0; then test fi - case "`cat $f`" in + case "$(cat $f)" in "$contents") ;; *) echo " $copy FAILED";; esac diff --git a/tests/mv/partition-perm b/tests/mv/partition-perm index 65ae5d024..bbda9da7a 100755 --- a/tests/mv/partition-perm +++ b/tests/mv/partition-perm @@ -31,7 +31,7 @@ test -f file && fail=1 test -f "$other_partition_tmpdir/file" || fail=1 # This would have failed with the mv from fileutils-4.0i. -mode=`ls -l "$other_partition_tmpdir/file" | cut -b-10` +mode=$(ls -l "$other_partition_tmpdir/file" | cut -b-10) test "$mode" = "-rwxrwxrwx" || fail=1 Exit $fail diff --git a/tests/mv/to-symlink b/tests/mv/to-symlink index 2a064b64f..c203d7a4b 100755 --- a/tests/mv/to-symlink +++ b/tests/mv/to-symlink @@ -38,6 +38,6 @@ mv $file $rem_symlink || fail=1 test -f $file && fail=1 # Make sure $rem_file is unmodified. -test `cat $rem_file` = remote || fail=1 +test $(cat $rem_file) = remote || fail=1 Exit $fail diff --git a/tests/mv/update b/tests/mv/update index d002a183b..f0beb4076 100755 --- a/tests/mv/update +++ b/tests/mv/update @@ -31,15 +31,15 @@ for interactive in '' -i; do # mistakenly elicit a prompt. $cp_or_mv $interactive --update old new < /dev/null > out 2>&1 || fail=1 test -s out && fail=1 - case "`cat new`" in new) ;; *) fail=1 ;; esac - case "`cat old`" in old) ;; *) fail=1 ;; esac + case "$(cat new)" in new) ;; *) fail=1 ;; esac + case "$(cat old)" in old) ;; *) fail=1 ;; esac done done # This will actually perform the rename. mv --update new old || fail=1 test -f new && fail=1 -case "`cat old`" in new) ;; *) fail=1 ;; esac +case "$(cat old)" in new) ;; *) fail=1 ;; esac # Restore initial conditions. echo old > old || fail=1 @@ -48,7 +48,7 @@ echo new > new || fail=1 # This will actually perform the copy. cp --update new old || fail=1 -case "`cat old`" in new) ;; *) fail=1 ;; esac -case "`cat new`" in new) ;; *) fail=1 ;; esac +case "$(cat old)" in new) ;; *) fail=1 ;; esac +case "$(cat new)" in new) ;; *) fail=1 ;; esac Exit $fail diff --git a/tests/other-fs-tmpdir b/tests/other-fs-tmpdir index d3d3a55cd..4bdfe6ff5 100644 --- a/tests/other-fs-tmpdir +++ b/tests/other-fs-tmpdir @@ -24,13 +24,13 @@ test "${CANDIDATE_TMP_DIRS+set}" = set \ other_partition_tmpdir= -dot_mount_point=`stat -c %d .` +dot_mount_point=$(stat -c %d .) for d in $CANDIDATE_TMP_DIRS; do # Skip nonexistent directories. test -d "$d" || continue - d_mount_point=`stat -L -c %d "$d"` + d_mount_point=$(stat -L -c %d "$d") # Same partition? Skip it. test "x$d_mount_point" = "x$dot_mount_point" && continue diff --git a/tests/readlink/can-e b/tests/readlink/can-e index 5dc73892d..32b75c595 100755 --- a/tests/readlink/can-e +++ b/tests/readlink/can-e @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ readlink -pwd=`pwd` +pwd=$(pwd) my_pwd=$("$abs_top_builddir/src/pwd") tmp=d @@ -38,7 +38,7 @@ cd "$pwd/$tmp/removed" || framework_failure_ # Skip this test if the system doesn't let you remove the working directory. if rmdir ../removed 2>/dev/null; then - v=`readlink -e .` && fail=1 + v=$(readlink -e .) && fail=1 test -z "$v" || fail=1 fi @@ -46,58 +46,58 @@ cd "$pwd/$tmp" || fail=1 for p in "" "$pwd/$tmp/"; do - v=`readlink -e "${p}regfile"` || fail=1 + v=$(readlink -e "${p}regfile") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -e "${p}./regfile/"` && fail=1 + v=$(readlink -e "${p}./regfile/") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}subdir"` || fail=1 + v=$(readlink -e "${p}subdir") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -e "${p}./subdir/"` || fail=1 + v=$(readlink -e "${p}./subdir/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -e "${p}missing"` && fail=1 + v=$(readlink -e "${p}missing") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}./missing/"` && fail=1 + v=$(readlink -e "${p}./missing/") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link1"` || fail=1 + v=$(readlink -e "${p}link1") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -e "${p}./link1/"` && fail=1 + v=$(readlink -e "${p}./link1/") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link1/more"` && fail=1 + v=$(readlink -e "${p}link1/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link2"` || fail=1 + v=$(readlink -e "${p}link2") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -e "${p}./link2/"` || fail=1 + v=$(readlink -e "${p}./link2/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -e "${p}link2/more"` && fail=1 + v=$(readlink -e "${p}link2/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link3"` && fail=1 + v=$(readlink -e "${p}link3") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}./link3/"` && fail=1 + v=$(readlink -e "${p}./link3/") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link3/more"` && fail=1 + v=$(readlink -e "${p}link3/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link4"` && fail=1 + v=$(readlink -e "${p}link4") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}./link4/"` && fail=1 + v=$(readlink -e "${p}./link4/") && fail=1 test -z "$v" || fail=1 - v=`readlink -e "${p}link4/more"` && fail=1 + v=$(readlink -e "${p}link4/more") && fail=1 test -z "$v" || fail=1 done diff --git a/tests/readlink/can-f b/tests/readlink/can-f index aff8c80ed..3f296010c 100755 --- a/tests/readlink/can-f +++ b/tests/readlink/can-f @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ readlink -pwd=`pwd` +pwd=$(pwd) my_pwd=$("$abs_top_builddir/src/pwd") tmp=d @@ -39,7 +39,7 @@ cd "$pwd/$tmp/removed" || framework_failure_ # Skip this test if the system doesn't let you remove the working directory. if rmdir ../removed 2>/dev/null; then - v=`readlink -e .` && fail=1 + v=$(readlink -e .) && fail=1 test -z "$v" || fail=1 fi @@ -47,106 +47,106 @@ cd "$pwd/$tmp" || fail=1 for p in "" "$pwd/$tmp/"; do - v=`readlink -f "${p}regfile"` || fail=1 + v=$(readlink -f "${p}regfile") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -f "${p}./regfile/"` && fail=1 + v=$(readlink -f "${p}./regfile/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}regfile/more"` && fail=1 + v=$(readlink -f "${p}regfile/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./regfile/more/"` && fail=1 + v=$(readlink -f "${p}./regfile/more/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}subdir"` || fail=1 + v=$(readlink -f "${p}subdir") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -f "${p}./subdir/"` || fail=1 + v=$(readlink -f "${p}./subdir/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -f "${p}subdir/more"` || fail=1 + v=$(readlink -f "${p}subdir/more") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}./subdir/more/"` || fail=1 + v=$(readlink -f "${p}./subdir/more/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}missing"` || fail=1 + v=$(readlink -f "${p}missing") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}./missing/"` || fail=1 + v=$(readlink -f "${p}./missing/") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}missing/more"` && fail=1 + v=$(readlink -f "${p}missing/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./missing/more/"` && fail=1 + v=$(readlink -f "${p}./missing/more/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link1"` || fail=1 + v=$(readlink -f "${p}link1") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -f "${p}./link1/"` && fail=1 + v=$(readlink -f "${p}./link1/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link1/more"` && fail=1 + v=$(readlink -f "${p}link1/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link1/more/"` && fail=1 + v=$(readlink -f "${p}./link1/more/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link2"` || fail=1 + v=$(readlink -f "${p}link2") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -f "${p}./link2/"` || fail=1 + v=$(readlink -f "${p}./link2/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -f "${p}link2/more"` || fail=1 + v=$(readlink -f "${p}link2/more") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}./link2/more/"` || fail=1 + v=$(readlink -f "${p}./link2/more/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}link2/more/more2"` && fail=1 + v=$(readlink -f "${p}link2/more/more2") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link2/more/more2/"` && fail=1 + v=$(readlink -f "${p}./link2/more/more2/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link3"` || fail=1 + v=$(readlink -f "${p}link3") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}./link3/"` || fail=1 + v=$(readlink -f "${p}./link3/") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}link3/more"` && fail=1 + v=$(readlink -f "${p}link3/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link3/more/"` && fail=1 + v=$(readlink -f "${p}./link3/more/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link4"` || fail=1 + v=$(readlink -f "${p}link4") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 - v=`readlink -f "${p}./link4/"` || fail=1 + v=$(readlink -f "${p}./link4/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 - v=`readlink -f "${p}link4/more"` && fail=1 + v=$(readlink -f "${p}link4/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link4/more"` && fail=1 + v=$(readlink -f "${p}./link4/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link5"` && fail=1 + v=$(readlink -f "${p}link5") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link5/"` && fail=1 + v=$(readlink -f "${p}./link5/") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}link5/more"` && fail=1 + v=$(readlink -f "${p}link5/more") && fail=1 test -z "$v" || fail=1 - v=`readlink -f "${p}./link5/more"` && fail=1 + v=$(readlink -f "${p}./link5/more") && fail=1 test -z "$v" || fail=1 done diff --git a/tests/readlink/can-m b/tests/readlink/can-m index d3e0b7c30..09a96f509 100755 --- a/tests/readlink/can-m +++ b/tests/readlink/can-m @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ readlink -pwd=`pwd` +pwd=$(pwd) my_pwd=$("$abs_top_builddir/src/pwd") tmp=d @@ -38,7 +38,7 @@ cd "$pwd/$tmp/removed" || framework_failure_ # Skip this test if the system doesn't let you remove the working directory. if rmdir ../removed 2>/dev/null; then - v=`readlink -e .` && fail=1 + v=$(readlink -e .) && fail=1 test -z "$v" || fail=1 fi @@ -46,94 +46,94 @@ cd "$pwd/$tmp" || fail=1 for p in "" "$pwd/$tmp/"; do - v=`readlink -m "${p}regfile"` || fail=1 + v=$(readlink -m "${p}regfile") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -m "${p}./regfile/"` || fail=1 + v=$(readlink -m "${p}./regfile/") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -m "${p}regfile/more"` || fail=1 + v=$(readlink -m "${p}regfile/more") || fail=1 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1 - v=`readlink -m "${p}./regfile/more/"` || fail=1 + v=$(readlink -m "${p}./regfile/more/") || fail=1 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1 - v=`readlink -m "${p}subdir"` || fail=1 + v=$(readlink -m "${p}subdir") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -m "${p}./subdir/"` || fail=1 + v=$(readlink -m "${p}./subdir/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -m "${p}subdir/more"` || fail=1 + v=$(readlink -m "${p}subdir/more") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -m "${p}./subdir/more/"` || fail=1 + v=$(readlink -m "${p}./subdir/more/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -m "${p}missing"` || fail=1 + v=$(readlink -m "${p}missing") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -m "${p}./missing/"` || fail=1 + v=$(readlink -m "${p}./missing/") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -m "${p}missing/more"` || fail=1 + v=$(readlink -m "${p}missing/more") || fail=1 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1 - v=`readlink -m "${p}./missing/more/"` || fail=1 + v=$(readlink -m "${p}./missing/more/") || fail=1 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1 - v=`readlink -m "${p}link1"` || fail=1 + v=$(readlink -m "${p}link1") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -m "${p}./link1/"` || fail=1 + v=$(readlink -m "${p}./link1/") || fail=1 test "$v" = "$my_pwd/$tmp/regfile" || fail=1 - v=`readlink -m "${p}link1/more"` || fail=1 + v=$(readlink -m "${p}link1/more") || fail=1 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1 - v=`readlink -m "${p}./link1/more/"` || fail=1 + v=$(readlink -m "${p}./link1/more/") || fail=1 test "$v" = "$my_pwd/$tmp/regfile/more" || fail=1 - v=`readlink -m "${p}link2"` || fail=1 + v=$(readlink -m "${p}link2") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -m "${p}./link2/"` || fail=1 + v=$(readlink -m "${p}./link2/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir" || fail=1 - v=`readlink -m "${p}link2/more"` || fail=1 + v=$(readlink -m "${p}link2/more") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -m "${p}./link2/more/"` || fail=1 + v=$(readlink -m "${p}./link2/more/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -m "${p}link2/more/more2"` || fail=1 + v=$(readlink -m "${p}link2/more/more2") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1 - v=`readlink -m "${p}./link2/more/more2/"` || fail=1 + v=$(readlink -m "${p}./link2/more/more2/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more/more2" || fail=1 - v=`readlink -m "${p}link3"` || fail=1 + v=$(readlink -m "${p}link3") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -m "${p}./link3/"` || fail=1 + v=$(readlink -m "${p}./link3/") || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -m "${p}link3/more"` || fail=1 + v=$(readlink -m "${p}link3/more") || fail=1 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1 - v=`readlink -m "${p}./link3/more/"` || fail=1 + v=$(readlink -m "${p}./link3/more/") || fail=1 test "$v" = "$my_pwd/$tmp/missing/more" || fail=1 - v=`readlink -m "${p}link4"` || fail=1 + v=$(readlink -m "${p}link4") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 - v=`readlink -m "${p}./link4/"` || fail=1 + v=$(readlink -m "${p}./link4/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 - v=`readlink -m "${p}link4/more"` || fail=1 + v=$(readlink -m "${p}link4/more") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1 - v=`readlink -m "${p}./link4/more/"` || fail=1 + v=$(readlink -m "${p}./link4/more/") || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing/more" || fail=1 done diff --git a/tests/readlink/rl-1 b/tests/readlink/rl-1 index 7f2ddc2e0..511a9890e 100755 --- a/tests/readlink/rl-1 +++ b/tests/readlink/rl-1 @@ -25,19 +25,19 @@ ln -s regfile link1 || framework_failure_ ln -s missing link2 || framework_failure_ -v=`readlink link1` || fail=1 +v=$(readlink link1) || fail=1 test "$v" = regfile || fail=1 -v=`readlink link2` || fail=1 +v=$(readlink link2) || fail=1 test "$v" = missing || fail=1 -v=`readlink subdir` && fail=1 +v=$(readlink subdir) && fail=1 test -z "$v" || fail=1 -v=`readlink regfile` && fail=1 +v=$(readlink regfile) && fail=1 test -z "$v" || fail=1 -v=`readlink missing` && fail=1 +v=$(readlink missing) && fail=1 test -z "$v" || fail=1 Exit $fail diff --git a/tests/rm/hash b/tests/rm/hash index dc443e1fd..344325e13 100755 --- a/tests/rm/hash +++ b/tests/rm/hash @@ -24,7 +24,7 @@ expensive_ # Create a hierarchy with 3*26 leaf directories, each at depth 153. echo "$0: creating 78 trees, each of depth 153; this will take a while..." >&2 -y=`seq 1 150|tr -sc '\n' y|tr '\n' /` +y=$(seq 1 150|tr -sc '\n' y|tr '\n' /) for i in 1 2 3; do for j in a b c d e f g h i j k l m n o p q r s t u v w x y z; do mkdir -p t/$i/$j/$y || framework_failure_ diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible index e9e1788ea..2f045815e 100755 --- a/tests/rm/inaccessible +++ b/tests/rm/inaccessible @@ -25,7 +25,7 @@ print_ver_ rm require_openat_support_ skip_if_root_ -p=`pwd` +p=$(pwd) mkdir abs1 abs2 no-access || framework_failure_ diff --git a/tests/rm/ir-1 b/tests/rm/ir-1 index ac2959020..01b33bc1e 100755 --- a/tests/rm/ir-1 +++ b/tests/rm/ir-1 @@ -48,7 +48,7 @@ rm --verbose -i -r $t < in > /dev/null 2>&1 || fail=1 test -d $t || fail=1 # There should be only one directory left. -case `echo $t/*` in +case $(echo $t/*) in $t/[abc]) ;; *) fail=1 ;; esac diff --git a/tests/rm/read-only b/tests/rm/read-only index e530dcee3..018648be0 100755 --- a/tests/rm/read-only +++ b/tests/rm/read-only @@ -20,7 +20,7 @@ print_ver_ rm require_root_ -cwd=`pwd` +cwd=$(pwd) cleanup_() { cd /; umount "$cwd/mnt"; } skip=0 diff --git a/tests/rm/readdir-bug b/tests/rm/readdir-bug index 939ce9862..711e1bc0e 100755 --- a/tests/rm/readdir-bug +++ b/tests/rm/readdir-bug @@ -26,8 +26,8 @@ print_ver_ rm # http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00326.html mkdir b || framework_failure_ cd b || framework_failure_ -for i in `seq 1 250`; do - touch `printf %040d $i` || framework_failure_ +for i in $(seq 1 250); do + touch $(printf %040d $i) || framework_failure_ done cd .. || framework_failure_ diff --git a/tests/rm/unread3 b/tests/rm/unread3 index 336c05a1b..4b8bbc2d3 100755 --- a/tests/rm/unread3 +++ b/tests/rm/unread3 @@ -23,7 +23,7 @@ skip_if_root_ mkdir -p a/1 b c d/2 e/3 || framework_failure_ -t=`pwd` +t=$(pwd) cd c chmod u=x,go= . diff --git a/tests/rmdir/ignore b/tests/rmdir/ignore index dd02819d2..92463b8d8 100755 --- a/tests/rmdir/ignore +++ b/tests/rmdir/ignore @@ -19,7 +19,7 @@ . "${srcdir=.}/init.sh"; path_prepend_ ../src print_ver_ rmdir -cwd=`pwd` +cwd=$(pwd) mkdir -p "$cwd/a/b/c" "$cwd/a/x" || framework_failure_ rmdir -p --ignore-fail-on-non-empty "$cwd/a/b/c" || fail=1 diff --git a/tests/tail-2/assert b/tests/tail-2/assert index 37b9afbcf..043e25937 100755 --- a/tests/tail-2/assert +++ b/tests/tail-2/assert @@ -51,7 +51,7 @@ mv f foo # echo waiting.... wait -case "`cat err`" in +case "$(cat err)" in *$ok) ;; *) fail=1;; esac diff --git a/tests/tail-2/assert-2 b/tests/tail-2/assert-2 index e6c95f824..d94d3d8e2 100755 --- a/tests/tail-2/assert-2 +++ b/tests/tail-2/assert-2 @@ -39,7 +39,7 @@ mv f foo # echo waiting.... wait -case "`cat err`" in +case "$(cat err)" in *$ok) ;; *) fail=1;; esac diff --git a/tests/touch/dangling-symlink b/tests/touch/dangling-symlink index 576a302bb..1eb2ed38a 100755 --- a/tests/touch/dangling-symlink +++ b/tests/touch/dangling-symlink @@ -32,7 +32,7 @@ rm -f touch-target t-symlink if test $fail = 1; then case $host_triplet in *linux-gnu*) - case "`uname -r`" in + case "$(uname -r)" in 2.3.9[0-9]*) skip_ \ '**************************************************** diff --git a/tests/touch/empty-file b/tests/touch/empty-file index cd679c41e..a150bd58e 100755 --- a/tests/touch/empty-file +++ b/tests/touch/empty-file @@ -48,7 +48,7 @@ echo sleeping for $SLEEP_SECONDS seconds... sleep $SLEEP_SECONDS for d in $TOUCH_DIR_LIST; do touch $d/a || fail=1 - set x `ls -t $d/a $d/b` + set x $(ls -t $d/a $d/b) test "$*" = "x $d/a $d/b" || fail=1 done @@ -56,11 +56,11 @@ echo sleeping for $SLEEP_SECONDS seconds... sleep $SLEEP_SECONDS for d in $TOUCH_DIR_LIST; do touch $d/b - set x `ls -t $d/a $d/b` + set x $(ls -t $d/a $d/b) test "$*" = "x $d/b $d/a" || fail=1 if touch - 1< $d/c 2> /dev/null; then - set x `ls -t $d/a $d/c` + set x $(ls -t $d/a $d/c) test "$*" = "x $d/c $d/a" || fail=1 fi diff --git a/tests/touch/no-dereference b/tests/touch/no-dereference index 6f031424e..aee9a5cfc 100755 --- a/tests/touch/no-dereference +++ b/tests/touch/no-dereference @@ -58,11 +58,11 @@ esac # Change the mtime of a symlink. touch -m -h -d 2009-10-10 link || fail=1 -case `stat --format=%y link` in +case $(stat --format=%y link) in 2009-10-10*) ;; *) fail=1 ;; esac -case `stat --format=%y file` in +case $(stat --format=%y file) in 2009-10-10*) fail=1;; esac diff --git a/tests/touch/no-rights b/tests/touch/no-rights index 25364e287..abebc5261 100755 --- a/tests/touch/no-rights +++ b/tests/touch/no-rights @@ -24,14 +24,14 @@ print_ver_ touch touch -d '2000-01-01 00:00' t1 || framework_failure_ touch -d '2000-01-02 00:00' t2 || framework_failure_ -set x `ls -t t1 t2` +set x $(ls -t t1 t2) test "$*" = "x t2 t1" || framework_failure_ chmod 0 t1 touch -d '2000-01-03 00:00' -c t1 || fail=1 -set x `ls -t t1 t2` +set x $(ls -t t1 t2) test "$*" = "x t1 t2" || fail=1 # Also test the combination of --no-create and -a. diff --git a/tests/touch/trailing-slash b/tests/touch/trailing-slash index f9c32fd7d..f09695c07 100755 --- a/tests/touch/trailing-slash +++ b/tests/touch/trailing-slash @@ -51,14 +51,14 @@ test -f nowhere && fail=1 # symlinks and directories under Cygwin 1.5). touch -d 2009-10-10 -h link2/ || fail=1 touch -h -r link2/ file || fail=1 -case `stat --format=%y dir` in +case $(stat --format=%y dir) in 2009-10-10*) ;; *) fail=1 ;; esac -case `stat --format=%y link2` in +case $(stat --format=%y link2) in 2009-10-10*) fail=1 ;; esac -case `stat --format=%y file` in +case $(stat --format=%y file) in 2009-10-10*) ;; *) fail=1 ;; esac