VirtualBox

source: kBuild/vendor/grep/2.12/tests/file@ 2595

Last change on this file since 2595 was 2595, checked in by bird, 12 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 1.4 KB
Line 
1#! /bin/sh
2# Test for POSIX.2 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-2012 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.

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