source: trunk/grep/tests/empty.sh@ 2749

Last change on this file since 2749 was 2557, checked in by bird, 19 years ago

grep 2.5.1a

File size: 798 bytes
Line 
1#!/bin/sh
2# test that the empty file means no pattern
3# and an empty pattern means match all.
4
5: ${srcdir=.}
6
7failures=0
8
9for options in '-E' '-E -w' '-F -x' '-G -w -x'; do
10
11 # should return 0 found a match
12 echo "" | ${GREP} $options -e '' > /dev/null 2>&1
13 if test $? -ne 0 ; then
14 echo "Status: Wrong status code, test \#1 failed ($options)"
15 failures=1
16 fi
17
18 # should return 1 found no match
19 echo "abcd" | ${GREP} $options -f /dev/null > /dev/null 2>&1
20 if test $? -ne 1 ; then
21 echo "Status: Wrong status code, test \#2 failed ($options)"
22 failures=1
23 fi
24
25 # should return 0 found a match
26 echo "abcd" | ${GREP} $options -f /dev/null -e "abcd" > /dev/null 2>&1
27 if test $? -ne 0 ; then
28 echo "Status: Wrong status code, test \#3 failed ($options)"
29 failures=1
30 fi
31done
32
33exit $failures
Note: See TracBrowser for help on using the repository browser.