963e5af221af47b9e6f9e773f848fca7f4032c87
[platform/upstream/coreutils.git] / tests / cp / no-deref-link2
1 #!/bin/sh
2 # FIXME: This test requires ln -s.
3 # cp from 3.16 fails this test
4
5 if test "$VERBOSE" = yes; then
6   set -x
7   cp --version
8 fi
9
10 rm -rf a b
11 mkdir b
12 msg=bar
13 echo $msg > a
14 cd b
15 ln -s ../a .
16 cd ..
17
18 fail=0
19
20 # It should fail with a message something like this:
21 #   cp: `a' and `b/foo' are the same file
22 cp -d a b 2>/dev/null
23
24 # Fail this test if the exit status is not 1
25 test $? = 1 || fail=1
26
27 test "`cat a`" = $msg || fail=1
28
29 rm -rf a b
30
31 exit $fail