tests: adjust \`...' quoting to '...' to adapt to latest gnulib
[coreutils.git] / tests / mv / mv-special-1
blob02b681e247515851a806dfb113798f11ea81de69
1 #! /bin/sh
2 # Test "mv" with special files.
4 # Copyright (C) 1998-2000, 2002, 2004-2012 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/init.sh"; path_prepend_ ../src
20 print_ver_ mv
21 cleanup_() { rm -rf "$other_partition_tmpdir"; }
22 . "$abs_srcdir/other-fs-tmpdir"
24 null=mv-null
25 dir=mv-dir
27 rm -f $null || framework_failure_
28 mknod $null p || framework_failure_
29 test -p $null || framework_failure_
30 mkdir -p $dir/a/b/c $dir/d/e/f || framework_failure_
31 touch $dir/a/b/c/file1 $dir/d/e/f/file2 || framework_failure_
33 # We used to...
34 # exit 77 here to indicate that we couldn't run the test.
35 # At least running on SunOS 4.1.4, using a directory NFS mounted
36 # from an OpenBSD system, the above mknod fails.
37 # It's not worth making an exception any more.
39 mv --verbose $null $dir "$other_partition_tmpdir" > out || fail=1
40 # Make sure the files are gone.
41 test -p $null && fail=1
42 test -d $dir && fail=1
43 # Make sure they were moved.
44 test -p "$other_partition_tmpdir/$null" || fail=1
45 test -d "$other_partition_tmpdir/$dir/a/b/c" || fail=1
47 # POSIX says rename (A, B) can succeed if A and B are on different file systems,
48 # so ignore chatter about when files are removed and copied rather than renamed.
49 sed "
50 /^removed /d
51 s,$other_partition_tmpdir,XXX,
52 " out | sort > out2
54 cat <<EOF | sort > exp
55 '$null' -> 'XXX/$null'
56 '$dir' -> 'XXX/$dir'
57 '$dir/a' -> 'XXX/$dir/a'
58 '$dir/a/b' -> 'XXX/$dir/a/b'
59 '$dir/a/b/c' -> 'XXX/$dir/a/b/c'
60 '$dir/a/b/c/file1' -> 'XXX/$dir/a/b/c/file1'
61 '$dir/d' -> 'XXX/$dir/d'
62 '$dir/d/e' -> 'XXX/$dir/d/e'
63 '$dir/d/e/f' -> 'XXX/$dir/d/e/f'
64 '$dir/d/e/f/file2' -> 'XXX/$dir/d/e/f/file2'
65 EOF
67 compare exp out2 || fail=1
69 # cd "$other_partition_tmpdir"
70 # ls -l -A -R "$other_partition_tmpdir"
72 Exit $fail