summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-08-16 18:41:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-08-16 18:42:31 -0700
commitf3da64c603f38591046e1a04b317d7863b8c7d09 (patch)
treede1fbef94f36abdeb6b171e68f32fa424309a045 /doc
parenta9515624709865d480e3142fd959bccd1c9372d1 (diff)
downloadgrep-f3da64c603f38591046e1a04b317d7863b8c7d09.tar.gz
doc: modernize portability advice
* doc/grep.texi (General Output Control, Basic vs Extended): No need to complicate the portability advice by talking about 7th edition grep, since it’s no longer a practical porting target. Instead, mention only Solaris 10 grep, the last practical holdout of somewhat-traditional grep.
Diffstat (limited to 'doc')
-rw-r--r--doc/grep.texi25
1 files changed, 5 insertions, 20 deletions
diff --git a/doc/grep.texi b/doc/grep.texi
index 3236b98a..b92ecb77 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -398,6 +398,9 @@ Quiet; do not write anything to standard output.
Exit immediately with zero status if any match is found,
even if an error was detected.
Also see the @option{-s} or @option{--no-messages} option.
+Portability note: Solaris 10 @command{grep} lacks @option{-q};
+portable shell scripts typically can redirect standard output to
+@file{/dev/null} instead of using @option{-q}.
(@option{-q} is specified by POSIX.)
@item -s
@@ -406,18 +409,6 @@ Also see the @option{-s} or @option{--no-messages} option.
@opindex --no-messages
@cindex suppress error messages
Suppress error messages about nonexistent or unreadable files.
-Portability note:
-unlike GNU @command{grep},
-7th Edition Unix @command{grep} did not conform to POSIX,
-because it lacked @option{-q}
-and its @option{-s} option behaved like
-GNU @command{grep}'s @option{-q} option.@footnote{Of course, 7th Edition
-Unix predated POSIX by several years!}
-USG-style @command{grep} also lacked @option{-q}
-but its @option{-s} option behaved like GNU @command{grep}'s.
-Portable shell scripts should avoid both
-@option{-q} and @option{-s} and should redirect
-standard and error output to @file{/dev/null} instead.
(@option{-s} is specified by POSIX.)
@end table
@@ -1560,14 +1551,8 @@ part of an interval expression.
@end itemize
@cindex interval expressions
-Traditional @command{egrep} did not support interval expressions and
-some @command{egrep} implementations use @samp{\@{} and @samp{\@}} instead, so
-portable scripts should avoid interval expressions in @samp{grep@ -E} patterns
-and should use @samp{[@{]} to match a literal @samp{@{}.
-
-GNU @command{grep@ -E} attempts to support traditional usage by
-assuming that @samp{@{} is not special if it would be the start of an
-invalid interval expression.
+GNU @samp{grep@ -E} treats @samp{@{} as special
+only if it begins a valid interval expression.
For example, the command
@samp{grep@ -E@ '@{1'} searches for the two-character string @samp{@{1}
instead of reporting a syntax error in the regular expression.