41910e1a343635a4625362e11c498760ac98597f
[platform/upstream/coreutils.git] / tests / cp / no-deref-link3
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 msg=bar
12 echo $msg > a
13 ln -s a b
14
15 fail=0
16
17 # It should fail with a message something like this:
18 #   cp: `a' and `b' are the same file
19 cp -d a b 2>/dev/null
20
21 # Fail this test if the exit status is not 1
22 test $? = 1 || fail=1
23
24 test "`cat a`" = $msg || fail=1
25
26 rm -f a b
27
28 exit $fail