diff options
author | Jim Meyering <meyering@redhat.com> | 2012-04-03 20:32:44 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-04-04 12:20:56 +0200 |
commit | e43d30eab3215bc9ff49ec7db3d3e2baa95ba070 (patch) | |
tree | b3828ca5bdc794f9b8648af1996d2863663c8590 /tests/ls/inode | |
parent | 64ecea53d9b4c1ecbf6d02ff8c4ae98b3a82e9a2 (diff) | |
download | coreutils-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/inode')
-rwxr-xr-x | tests/ls/inode | 12 |
1 files changed, 6 insertions, 6 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 |