c51448a550a0ecbbfd886073ac3da067d097dc53
[platform/upstream/coreutils.git] / tests / mv / dir-file
1 #!/bin/sh
2 # mv must fail when src and dest are mismatched directory/non-directory.
3
4 if test "$VERBOSE" = yes; then
5   set -x
6   mv --version
7 fi
8
9 tmp=mv-mismatch-$$
10 pwd=`pwd`
11 trap "cd $pwd; rm -rf $tmp" 0 1 2 3 15
12
13 framework_failure=0
14 mkdir $tmp || framework_failure=1
15 cd $tmp
16 mkdir -p dir/file || framework_failure=1
17 > file || framework_failure=1
18
19 if test $framework_failure = 1; then
20   echo 'failure in testing framework'
21   exit 1
22 fi
23
24 fail=0
25
26 # These should both fail, but until fileutils-4.0q only the second one did.
27 mv dir file > /dev/null 2>&1 && fail=1
28 mv file dir > /dev/null 2>&1 && fail=1
29
30 exit $fail