VirtualBox

source: kBuild/vendor/grep/3.7/tests/options@ 3576

Last change on this file since 3576 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#
4# Copyright (C) 2001, 2006, 2009-2021 Free Software Foundation, Inc.
5#
6# Copying and distribution of this file, with or without modification,
7# are permitted in any medium without royalty provided the copyright
8# notice and this notice are preserved.
9#
10# grep [ -E| -F][ -c| -l| -q ][-insvx] -e pattern_list
11# [-f pattern_file] ... [file. ..]
12# grep [ -E| -F][ -c| -l| -q ][-insvx][-e pattern_list]
13# -f pattern_file ... [file ...]
14# grep [ -E| -F][ -c| -l| -q ][-insvx] pattern_list [file...]
15
16. "${srcdir=.}/init.sh"; path_prepend_ ../src
17
18fail=0
19
20# checking for -E extended regex
21echo "abababccccccd" | grep -E -e 'c{3}' > /dev/null 2>&1
22if test $? -ne 0 ; then
23 echo "Options: Wrong status code, test #1 failed"
24 fail=1
25fi
26
27# checking for basic regex
28echo "abababccccccd" | grep -G -e 'c\{3\}' > /dev/null 2>&1
29if test $? -ne 0 ; then
30 echo "Options: Wrong status code, test #2 failed"
31 fail=1
32fi
33
34# checking for fixed string
35echo "abababccccccd" | grep -F -e 'c\{3\}' > /dev/null 2>&1
36if test $? -ne 1 ; then
37 echo "Options: Wrong status code, test #3 failed"
38 fail=1
39fi
40
41# checking for multiple -e options; see:
42# https://bugs.gnu.org/21670
43echo abchelloabc | grep -e '^hello' -e 'hello$' > /dev/null 2>&1
44if test $? -ne 1 ; then
45 echo "Options: Wrong status code, test #4 failed"
46 fail=1
47fi
48
49Exit $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