summaryrefslogtreecommitdiff
path: root/tests/cp/link-preserve
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/cp/link-preserve
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/cp/link-preserve')
-rwxr-xr-xtests/cp/link-preserve26
1 files changed, 13 insertions, 13 deletions
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
# --------------------------------------