summaryrefslogtreecommitdiff
path: root/tests/ln
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/ln
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/ln')
-rwxr-xr-xtests/ln/hard-to-sym10
-rwxr-xr-xtests/ln/misc2
-rwxr-xr-xtests/ln/sf-12
3 files changed, 7 insertions, 7 deletions
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