2 # Test for status code for GNU grep.
12 # should return 0 found a match
13 echo "abcd" | ${GREP} -E -e 'abc' > /dev/null 2>&1
14 if test $? -ne 0 ; then
15 echo "Status: Wrong status code, test \#1 failed"
19 # should return 1 found no match
20 echo "abcd" | ${GREP} -E -e 'zbc' > /dev/null 2>&1
21 if test $? -ne 1 ; then
22 echo "Status: Wrong status code, test \#2 failed"
26 # the filename MMMMMMMM.MMM should not exist hopefully
27 if test -r MMMMMMMM.MMM; then
28 echo "Please remove MMMMMMMM.MMM to run check"
30 # should return 2 file not found
31 ${GREP} -E -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1
32 if test $? -ne 2 ; then
33 echo "Status: Wrong status code, test \#3 failed"
37 # should return 2 file not found
38 ${GREP} -E -s -e 'abc' MMMMMMMM.MMM > /dev/null 2>&1
39 if test $? -ne 2 ; then
40 echo "Status: Wrong status code, test \#4 failed"
44 # should return 0 found a match
45 echo "abcd" | ${GREP} -E -q -s 'abc' MMMMMMMM.MMM - > /dev/null 2>&1
46 if test $? -ne 0 ; then
47 echo "Status: Wrong status code, test \#5 failed"