2 # exercise another small part of remove.c
4 # Copyright (C) 2002-2004, 2006-2009 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 if test "$VERBOSE" = yes; then
27 mkdir -p z || framework_failure
28 cd z || framework_failure
29 touch empty empty-u || framework_failure
33 mkdir d du || framework_failure
34 chmod u-w fu du empty-u || framework_failure
50 # Both of these should fail.
51 rm -ir z < in > out 2>&1 || fail=1
53 # Given input like `rm: ...? rm: ...? ' (no trailing newline),
54 # the `head...' part of the pipeline below removes the trailing space, so
55 # that sed doesn't have to deal with a line lacking a terminating newline.
56 # This avoids a bug whereby some vendor-provided (Tru64) versions of sed
57 # would mistakenly tack a newline onto the end of the output.
58 tr '?' '\n' < out | head --bytes=-1 | sed 's/^ //' |sort > o2
61 sort <<EOF > exp || fail=1
62 rm: descend into directory \`z'
63 rm: remove regular empty file \`z/empty'
64 rm: remove write-protected regular file \`z/fu'
65 rm: remove write-protected regular empty file \`z/empty-u'
66 rm: remove symbolic link \`z/slink'
67 rm: remove symbolic link \`z/slinkdot'
68 rm: remove directory \`z/d'
69 rm: remove write-protected directory \`z/du'
70 rm: remove directory \`z'
73 compare out exp || fail=1