summaryrefslogtreecommitdiff
path: root/tests/cp/backup-1
blob: 25c179cf8c6acdf7e1fb7584102edc10c6937c2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh

: ${CP=cp}

suffix=.b
tmp=b1.$$
tmp_backup="$tmp$suffix"
temp_files="$tmp $tmp_backup"
rm -f $temp_files

fail=0
echo test > $tmp || fail=1

$CP --force --backup --version-control=simple --suffix=$suffix $tmp $tmp \
  || fail=1

test -f $tmp || fail=1
test -f $tmp_backup || fail=1
cmp $tmp $tmp_backup > /dev/null || fail=1

rm -f $temp_files

exit $fail