summaryrefslogtreecommitdiff
path: root/tests/ls
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-04-03 20:32:44 +0200
committerJim Meyering <meyering@redhat.com>2012-04-04 12:20:56 +0200
commite43d30eab3215bc9ff49ec7db3d3e2baa95ba070 (patch)
treeb3828ca5bdc794f9b8648af1996d2863663c8590 /tests/ls
parent64ecea53d9b4c1ecbf6d02ff8c4ae98b3a82e9a2 (diff)
downloadcoreutils-e43d30eab3215bc9ff49ec7db3d3e2baa95ba070.tar.xz
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
Diffstat (limited to 'tests/ls')
-rwxr-xr-xtests/ls/inode12
-rwxr-xr-xtests/ls/nameless-uid2
-rwxr-xr-xtests/ls/stat-dtype2
-rwxr-xr-xtests/ls/stat-vs-dirent12
-rwxr-xr-xtests/ls/symlink-slash2
5 files changed, 15 insertions, 15 deletions
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