options.sh revision 302408
1#!/bin/sh
2# Test for POSIX.2 options for grep
3#
4# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list 
5#      [-f pattern_file] ... [file. ..]
6# grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list]
7#      -f pattern_file ... [file ...]
8# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...]
9#
10
11: ${srcdir=.}
12
13failures=0
14
15# checking for -E extended regex
16echo "abababccccccd" | ${GREP} -E -e 'c{3}' > /dev/null 2>&1
17if test $? -ne 0 ; then
18        echo "Options: Wrong status code, test \#1 failed"
19        failures=1
20fi
21
22# checking for basic regex
23echo "abababccccccd" | ${GREP} -G -e 'c\{3\}' > /dev/null 2>&1
24if test $? -ne 0 ; then
25        echo "Options: Wrong status code, test \#2 failed"
26        failures=1
27fi
28
29# checking for fixed string 
30echo "abababccccccd" | ${GREP} -F -e 'c\{3\}' > /dev/null 2>&1
31if test $? -ne 1 ; then
32	echo "Options: Wrong status code, test \#3 failed"
33	failures=1
34fi
35
36exit $failures
37