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