summaryrefslogtreecommitdiff
path: root/doc/grep.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/grep.texi')
-rw-r--r--doc/grep.texi15
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/grep.texi b/doc/grep.texi
index 890ba1b2..da103c49 100644
--- a/doc/grep.texi
+++ b/doc/grep.texi
@@ -935,12 +935,8 @@ follow file names must be treated as file names;
by default,
such options are permuted to the front of the operand list
and are treated as options.
-Also,
-@sc{posix.2} requires that unrecognized options be diagnosed as ``illegal'',
-but since they are not really against the law the default
-is to diagnose them as ``invalid''.
-@code{POSIXLY_CORRECT} also disables @code{_@var{N}_GNU_nonoption_argv_flags_},
-described below.
+Also, @code{POSIXLY_CORRECT} disables special handling of an
+invalid bracket expression. @xref{invalid-bracket-expr}.
@item _@var{N}_GNU_nonoption_argv_flags_
@vindex _@var{N}_GNU_nonoption_argv_flags_ @r{environment variable}
@@ -1269,6 +1265,13 @@ encoding, whereas the former is independent of locale and character set.
part of the symbolic names, and must be included in addition to
the brackets delimiting the bracket expression.)
+@anchor{invalid-bracket-expr}
+If you mistakenly omit the outer brackets, and search for say, @samp{[:upper:]},
+GNU @command{grep} prints a diagnostic and exits with status 2, on
+the assumption that you did not intend to search for the nominally
+equivalent regular expression: @samp{[:epru]}.
+Set the @code{POSIXLY_CORRECT} environment variable to disable this feature.
+
Most meta-characters lose their special meaning inside bracket expressions.
@table @samp