.
[platform/upstream/coreutils.git] / tests / cp / no-deref-link1
1 #!/bin/sh
2 # FIXME: This test requires ln -s.
3 # cp from 3.16 fails this test
4
5 : ${CP=cp}
6
7 rm -rf a b
8 mkdir a b
9 msg=bar
10 echo $msg > a/foo
11 cd b
12 ln -s ../a/foo .
13 cd ..
14
15 fail=0
16
17 # It should fail with a message something like this:
18 #   ./cp: `a/foo' and `b/foo' are the same file
19 $CP -d a/foo 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/foo`" = $msg || fail=1
25
26 rm -rf a b
27
28 exit $fail