*** empty log message ***
[coreutils.git] / tests / mv / backup-is-src
blob90c0bf3b8b81a9cd72aac939376b0a2844b1dc5a
1 #!/bin/sh
2 # Force mv to use the copying code.
4 if test "$VERBOSE" = yes; then
5 set -x
6 mv --version
7 fi
9 . $srcdir/setup
11 if test -z "$other_partition_tmpdir"; then
12 exit 77
15 a="$other_partition_tmpdir/a"
16 a2="$other_partition_tmpdir/a~"
18 framework_failure=0
19 rm -f $a $a2 || framework_failure=1
20 echo a > $a || framework_failure=1
21 echo a2 > $a2 || framework_failure=1
23 if test $framework_failure = 1; then
24 echo 'failure in testing framework'
25 exit 1
28 # Make sure we get English translations.
29 LANGUAGE=C
30 export LANGUAGE
31 LC_ALL=C
32 export LC_ALL
33 LANG=C
34 export LANG
36 # This mv command should exit nonzero.
37 mv --b=simple $a2 $a > out 2>&1 && fail=1
39 sed \
40 -e "s,mv:,XXX:," \
41 -e "s,$a,YYY," \
42 -e "s,$a2,ZZZ," \
43 out > out2
45 cat > exp <<\EOF
46 XXX: backing up `YYY' would destroy source; `ZZZ' not moved
47 EOF
49 cmp out2 exp || fail=1
51 rm -fr out out2 exp $a $a2 $other_partition_tmpdir
53 exit $fail