VirtualBox

source: kBuild/trunk/src/grep/tests/file

Last change on this file was 3529, checked in by bird, 3 years ago

Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props.

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#! /bin/sh
2# Test for POSIX options for grep:
3# grep -E -f pattern_file file
4# grep -F -f pattern_file file
5# grep -G -f pattern_file file
6#
7# Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc.
8#
9# Copying and distribution of this file, with or without modification,
10# are permitted in any medium without royalty provided the copyright
11# notice and this notice are preserved.
12
13. "${srcdir=.}/init.sh"; path_prepend_ ../src
14
15fail=0
16
17cat <<EOF >patfile
18radar
19MILES
20GNU
21EOF
22
23# match
24echo "miles" | grep -i -E -f patfile > /dev/null 2>&1
25if test $? -ne 0 ; then
26 echo "File_pattern: Wrong status code, test \#1 failed"
27 fail=1
28fi
29
30# match
31echo "GNU" | grep -G -f patfile > /dev/null 2>&1
32if test $? -ne 0 ; then
33 echo "File_pattern: Wrong status code, test \#2 failed"
34 fail=1
35fi
36
37# checking for no match
38echo "ridar" | grep -F -f patfile > /dev/null 2>&1
39if test $? -ne 1 ; then
40 echo "File_pattern: Wrong status code, test \#3 failed"
41 fail=1
42fi
43
44cat <<EOF >patfile
45
46EOF
47# empty pattern : every match
48echo "abbcd" | grep -F -f patfile > /dev/null 2>&1
49if test $? -ne 0 ; then
50 echo "File_pattern: Wrong status code, test \#4 failed"
51 fail=1
52fi
53
54cp /dev/null patfile
55
56# null pattern : no match
57echo "abbcd" | grep -F -f patfile > /dev/null 2>&1
58if test $? -ne 1 ; then
59 echo "File_pattern: Wrong status code, test \#5 failed"
60 fail=1
61fi
62
63Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette