6ed1ca5dbf6f634d795514a27f1157bc08ac9025
[platform/upstream/coreutils.git] / tests / shred / exact
1 #!/bin/sh
2 # make sure that neither --exact nor --zero gobbles a command line argument
3
4 if test "$VERBOSE" = yes; then
5   set -x
6   shred --version
7 fi
8
9 pwd=`pwd`
10 tmp=exact.$$
11 trap 'status=$?; cd $pwd; rm -rf $tmp && exit $status' 0
12 trap '(exit $?); exit' 1 2 13 15
13
14 framework_failure=0
15 mkdir $tmp || framework_failure=1
16 cd $tmp || framework_failure=1
17
18 if test $framework_failure = 1; then
19   echo 'failure in testing framework'
20   (exit 1); exit 1
21 fi
22
23 fail=0
24
25 for opt in --exact --zero; do
26   echo a > a || fail=1
27   echo bb > b || fail=1
28   echo ccc > c || fail=1
29
30   shred --remove $opt a b || fail=1
31   test -f a && fail=1
32   test -f b && fail=1
33
34   shred --remove $opt c || fail=1
35   test -f c && fail=1
36 done
37
38 (exit $fail); exit $fail