*** empty log message ***
[coreutils.git] / tests / mv / i-link-no
blobed72164abe5fd0492e83edcee06056949bc8f455
1 #!/bin/sh
2 # Show that mv doesn't preserve links to files the user has declined to move.
4 if test "$VERBOSE" = yes; then
5 set -x
6 mv --version
7 fi
9 . $srcdir/../envvar-check
10 . $srcdir/../lang-default
12 pwd=`pwd`
13 tmp=i-link-no.$$
14 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
15 trap '(exit $?); exit' 1 2 13 15
17 framework_failure=0
18 mkdir $tmp || framework_failure=1
19 cd $tmp || framework_failure=1
20 mkdir a b || framework_failure=1
21 echo foo > a/foo || framework_failure=1
22 ln a/foo a/bar || framework_failure=1
23 echo FUBAR > b/FUBAR || framework_failure=1
24 ln b/FUBAR b/bar || framework_failure=1
25 chmod a-w b/bar || framework_failure=1
27 if test $framework_failure = 1; then
28 echo "$0: failure in testing framework" 1>&2
29 (exit 1); exit
32 fail=0
34 mv --reply=no a/bar a/foo b 2> err > out || fail=1
35 cat <<EOF > exp
36 EOF
38 cat <<EOF > exp_err
39 EOF
41 cmp err exp_err || fail=1
42 test $fail = 1 && diff err exp_err 2> /dev/null
44 cmp out exp || fail=1
45 test $fail = 1 && diff out exp 2> /dev/null
47 case "`cat b/foo`" in
48 foo) ;;
49 *) fail=1;;
50 esac
52 (exit $fail); exit