*** empty log message ***
[coreutils.git] / tests / mv / force
blobf14b6c9c556e672065866e85fd05fc98bbb650c2
1 #!/bin/sh
2 # move a file onto itself with --force
4 if test "$VERBOSE" = yes; then
5 set -x
6 mv --version
7 fi
9 ff=force-file
10 ff2=force-file-2
12 framework_failure=0
13 rm -f $ff $ff2 || framework_failure=1
14 echo force-contents > $ff || framework_failure=1
15 ln $ff $ff2 || framework_failure=1
17 if test $framework_failure = 1; then
18 echo 'failure in testing framework'
19 exit 1
22 # Make sure we get English translations.
23 LANGUAGE=C
24 export LANGUAGE
25 LC_ALL=C
26 export LC_ALL
27 LANG=C
28 export LANG
30 # This mv command should exit nonzero.
31 mv --force $ff $ff > out 2>&1 && fail=1
33 cat > exp <<EOF
34 mv: \`$ff' and \`$ff' are the same file
35 EOF
37 cmp out exp || fail=1
38 test `cat $ff` = force-contents || fail=1
40 # This should succeed, even though the source and destination
41 # device and inodes are the same.
42 mv --force $ff $ff2 || fail=1
44 rm -fr out exp $ff $ff2
46 exit $fail