CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 21/08/14 16:46:41
Index: html_node/Environment-Variables.html =================================================================== RCS file: /webcvs/grep/grep/manual/html_node/Environment-Variables.html,v retrieving revision 1.31 retrieving revision 1.32 diff -u -b -r1.31 -r1.32 --- html_node/Environment-Variables.html 28 Sep 2020 03:36:49 -0000 1.31 +++ html_node/Environment-Variables.html 14 Aug 2021 20:46:40 -0000 1.32 @@ -1,8 +1,11 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> +<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!-- This manual is for grep, a pattern matching engine. -Copyright (C) 1999-2002, 2005, 2008-2020 Free Software Foundation, +Copyright (C) 1999-2002, 2005, 2008-2021 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -11,71 +14,61 @@ Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> -<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<title>Environment Variables (GNU Grep 3.5)</title> +<title>Environment Variables (GNU Grep 3.7)</title> -<meta name="description" content="Environment Variables (GNU Grep 3.5)"> -<meta name="keywords" content="Environment Variables (GNU Grep 3.5)"> +<meta name="description" content="Environment Variables (GNU Grep 3.7)"> +<meta name="keywords" content="Environment Variables (GNU Grep 3.7)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> -<link href="index.html#Top" rel="start" title="Top"> -<link href="Index.html#Index" rel="index" title="Index"> +<meta name="viewport" content="width=device-width,initial-scale=1"> + +<link href="index.html" rel="start" title="Top"> +<link href="Index.html" rel="index" title="Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> -<link href="Invoking.html#Invoking" rel="up" title="Invoking"> -<link href="Exit-Status.html#Exit-Status" rel="next" title="Exit Status"> -<link href="Other-Options.html#Other-Options" rel="prev" title="Other Options"> +<link href="Invoking.html" rel="up" title="Invoking"> +<link href="Exit-Status.html" rel="next" title="Exit Status"> +<link href="Command_002dline-Options.html" rel="prev" title="Command-line Options"> <style type="text/css"> <!-- +a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em} a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} -blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} -blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} -div.lisp {margin-left: 3.2em} -div.smalldisplay {margin-left: 3.2em} -div.smallexample {margin-left: 3.2em} -div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} -pre.smalldisplay {font-family: inherit; font-size: smaller} -pre.smallexample {font-size: smaller} -pre.smallformat {font-family: inherit; font-size: smaller} -pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} +span:hover a.copiable-anchor {visibility: visible} ul.no-bullet {list-style: none} --> </style> -<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css"> +<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css"> </head> <body lang="en"> -<a name="Environment-Variables"></a> +<div class="section" id="Environment-Variables"> <div class="header"> <p> -Next: <a href="Exit-Status.html#Exit-Status" accesskey="n" rel="next">Exit Status</a>, Previous: <a href="Command_002dline-Options.html#Command_002dline-Options" accesskey="p" rel="prev">Command-line Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> +Next: <a href="Exit-Status.html" accesskey="n" rel="next">Exit Status</a>, Previous: <a href="Command_002dline-Options.html" accesskey="p" rel="prev">Command-line Options</a>, Up: <a href="Invoking.html" accesskey="u" rel="up">Invoking <code>grep</code></a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> </div> <hr> -<a name="Environment-Variables-1"></a> -<h3 class="section">2.2 Environment Variables</h3> +<span id="Environment-Variables-1"></span><h3 class="section">2.2 Environment Variables</h3> <p>The behavior of <code>grep</code> is affected by the following environment variables. </p> -<a name="index-LANGUAGE-environment-variable"></a> -<a name="index-LC_005fALL-environment-variable"></a> -<a name="index-LC_005fMESSAGES-environment-variable"></a> -<a name="index-LANG-environment-variable"></a> +<span id="index-LANGUAGE-environment-variable"></span> +<span id="index-LC_005fALL-environment-variable"></span> +<span id="index-LC_005fMESSAGES-environment-variable"></span> +<span id="index-LANG-environment-variable"></span> <p>The locale for category <code><span class="nolinebreak">LC_</span><var>foo</var></code><!-- /@w --> is specified by examining the three environment variables <code>LC_ALL</code>, <code><span class="nolinebreak">LC_</span><var>foo</var></code><!-- /@w -->, and <code>LANG</code>, @@ -129,31 +122,11 @@ These capabilities are stored in an online database and accessed by the <code>terminfo</code> library. </p> -<a name="index-environment-variables"></a> +<span id="index-environment-variables"></span> <dl compact="compact"> -<dt><code>GREP_OPTIONS</code></dt> -<dd><a name="index-GREP_005fOPTIONS-environment-variable"></a> -<a name="index-default-options-environment-variable"></a> -<p>This variable specifies default options to be placed in front of any -explicit options. -As this causes problems when writing portable scripts, this feature -will be removed in a future release of <code>grep</code>, and <code>grep</code> -warns if it is used. Please use an alias or script instead. -For example, if <code>grep</code> is in the directory ‘<samp>/usr/bin</samp>’ you -can prepend <samp>$HOME/bin</samp> to your <code>PATH</code> and create an -executable script <samp>$HOME/bin/grep</samp> containing the following: -</p> -<div class="example"> -<pre class="example">#! /bin/sh -export PATH=/usr/bin -exec grep --color=auto --devices=skip "$@" -</pre></div> - -</dd> -<dt><code>GREP_COLOR</code></dt> -<dd><a name="index-GREP_005fCOLOR-environment-variable"></a> -<a name="index-highlight-markers"></a> +<dt id='index-GREP_005fCOLOR-environment-variable'><span><code>GREP_COLOR</code><a href='#index-GREP_005fCOLOR-environment-variable' class='copiable-anchor'> ¶</a></span></dt> +<dd><span id="index-highlight-markers"></span> <p>This variable specifies the color used to highlight matched (non-empty) text. It is deprecated in favor of <code>GREP_COLORS</code>, but still supported. The ‘<samp>mt</samp>’, ‘<samp>ms</samp>’, and ‘<samp>mc</samp>’ capabilities of <code>GREP_COLORS</code> @@ -166,9 +139,8 @@ which means a bold red foreground text on the terminal’s default background. </p> </dd> -<dt><code>GREP_COLORS</code></dt> -<dd><a name="index-GREP_005fCOLORS-environment-variable"></a> -<a name="index-highlight-markers-1"></a> +<dt id='index-GREP_005fCOLORS-environment-variable'><span><code>GREP_COLORS</code><a href='#index-GREP_005fCOLORS-environment-variable' class='copiable-anchor'> ¶</a></span></dt> +<dd><span id="index-highlight-markers-1"></span> <p>This variable specifies the colors and other attributes used to highlight various parts of the output. Its value is a colon-separated list of <code>terminfo</code> capabilities @@ -177,9 +149,8 @@ Supported capabilities are as follows. </p> <dl compact="compact"> -<dt><code>sl=</code></dt> -<dd><a name="index-sl-GREP_005fCOLORS-capability"></a> -<p>SGR substring for whole selected lines +<dt id='index-sl-GREP_005fCOLORS-capability'><span><code>sl=</code><a href='#index-sl-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for whole selected lines (i.e., matching lines when the <samp>-v</samp> command-line option is omitted, or non-matching lines when <samp>-v</samp> is specified). @@ -189,9 +160,8 @@ The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<dt><code>cx=</code></dt> -<dd><a name="index-cx-GREP_005fCOLORS-capability"></a> -<p>SGR substring for whole context lines +<dt id='index-cx-GREP_005fCOLORS-capability'><span><code>cx=</code><a href='#index-cx-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for whole context lines (i.e., non-matching lines when the <samp>-v</samp> command-line option is omitted, or matching lines when <samp>-v</samp> is specified). @@ -201,17 +171,15 @@ The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<dt><code>rv</code></dt> -<dd><a name="index-rv-GREP_005fCOLORS-capability"></a> -<p>Boolean value that reverses (swaps) the meanings of +<dt id='index-rv-GREP_005fCOLORS-capability'><span><code>rv</code><a href='#index-rv-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>Boolean value that reverses (swaps) the meanings of the ‘<samp>sl=</samp>’ and ‘<samp>cx=</samp>’ capabilities when the <samp>-v</samp> command-line option is specified. The default is false (i.e., the capability is omitted). </p> </dd> -<dt><code>mt=01;31</code></dt> -<dd><a name="index-mt-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in any matching line +<dt id='index-mt-GREP_005fCOLORS-capability'><span><code>mt=01;31</code><a href='#index-mt-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in any matching line (i.e., a selected line when the <samp>-v</samp> command-line option is omitted, or a context line when <samp>-v</samp> is specified). @@ -220,45 +188,39 @@ The default is a bold red text foreground over the current line background. </p> </dd> -<dt><code>ms=01;31</code></dt> -<dd><a name="index-ms-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in a selected line. +<dt id='index-ms-GREP_005fCOLORS-capability'><span><code>ms=01;31</code><a href='#index-ms-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in a selected line. (This is used only when the <samp>-v</samp> command-line option is omitted.) The effect of the ‘<samp>sl=</samp>’ (or ‘<samp>cx=</samp>’ if ‘<samp>rv</samp>’) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. </p> </dd> -<dt><code>mc=01;31</code></dt> -<dd><a name="index-mc-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in a context line. +<dt id='index-mc-GREP_005fCOLORS-capability'><span><code>mc=01;31</code><a href='#index-mc-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in a context line. (This is used only when the <samp>-v</samp> command-line option is specified.) The effect of the ‘<samp>cx=</samp>’ (or ‘<samp>sl=</samp>’ if ‘<samp>rv</samp>’) capability remains active when this takes effect. The default is a bold red text foreground over the current line background. </p> </dd> -<dt><code>fn=35</code></dt> -<dd><a name="index-fn-GREP_005fCOLORS-capability"></a> -<p>SGR substring for file names prefixing any content line. +<dt id='index-fn-GREP_005fCOLORS-capability'><span><code>fn=35</code><a href='#index-fn-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for file names prefixing any content line. The default is a magenta text foreground over the terminal’s default background. </p> </dd> -<dt><code>ln=32</code></dt> -<dd><a name="index-ln-GREP_005fCOLORS-capability"></a> -<p>SGR substring for line numbers prefixing any content line. +<dt id='index-ln-GREP_005fCOLORS-capability'><span><code>ln=32</code><a href='#index-ln-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for line numbers prefixing any content line. The default is a green text foreground over the terminal’s default background. </p> </dd> -<dt><code>bn=32</code></dt> -<dd><a name="index-bn-GREP_005fCOLORS-capability"></a> -<p>SGR substring for byte offsets prefixing any content line. +<dt id='index-bn-GREP_005fCOLORS-capability'><span><code>bn=32</code><a href='#index-bn-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for byte offsets prefixing any content line. The default is a green text foreground over the terminal’s default background. </p> </dd> -<dt><code>se=36</code></dt> -<dd><a name="index-fn-GREP_005fCOLORS-capability-1"></a> -<p>SGR substring for separators that are inserted +<dt id='index-fn-GREP_005fCOLORS-capability-1'><span><code>se=36</code><a href='#index-fn-GREP_005fCOLORS-capability-1' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>SGR substring for separators that are inserted between selected line fields (‘<samp>:</samp>’), between context line fields (‘<samp>-</samp>’), and between groups of adjacent lines @@ -266,9 +228,8 @@ The default is a cyan text foreground over the terminal’s default background. </p> </dd> -<dt><code>ne</code></dt> -<dd><a name="index-ne-GREP_005fCOLORS-capability"></a> -<p>Boolean value that prevents clearing to the end of line +<dt id='index-ne-GREP_005fCOLORS-capability'><span><code>ne</code><a href='#index-ne-GREP_005fCOLORS-capability' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right (‘<samp>\33[K</samp>’) each time a colorized item ends. This is needed on terminals on which EL is not supported. @@ -286,55 +247,51 @@ </p> </dd> -<dt><code>LC_ALL</code></dt> -<dt><code>LC_COLLATE</code></dt> -<dt><code>LANG</code></dt> -<dd><a name="index-LC_005fALL-environment-variable-1"></a> -<a name="index-LC_005fCOLLATE-environment-variable"></a> -<a name="index-LANG-environment-variable-1"></a> -<a name="index-character-type"></a> -<a name="index-national-language-support"></a> -<a name="index-NLS"></a> +<dt id='index-LC_005fALL-environment-variable-1'><span><code>LC_ALL</code><a href='#index-LC_005fALL-environment-variable-1' class='copiable-anchor'> ¶</a></span></dt> +<dt><span><code>LC_COLLATE</code></span></dt> +<dt><span><code>LANG</code></span></dt> +<dd><span id="index-LC_005fCOLLATE-environment-variable"></span> +<span id="index-LANG-environment-variable-1"></span> +<span id="index-character-type"></span> +<span id="index-national-language-support"></span> +<span id="index-NLS"></span> <p>These variables specify the locale for the <code>LC_COLLATE</code> category, which might affect how range expressions like ‘<samp>[a-z]</samp>’ are interpreted. </p> </dd> -<dt><code>LC_ALL</code></dt> -<dt><code>LC_CTYPE</code></dt> -<dt><code>LANG</code></dt> -<dd><a name="index-LC_005fALL-environment-variable-2"></a> -<a name="index-LC_005fCTYPE-environment-variable"></a> -<a name="index-LANG-environment-variable-2"></a> -<a name="index-encoding-error"></a> -<a name="index-null-character"></a> +<dt id='index-LC_005fALL-environment-variable-2'><span><code>LC_ALL</code><a href='#index-LC_005fALL-environment-variable-2' class='copiable-anchor'> ¶</a></span></dt> +<dt><span><code>LC_CTYPE</code></span></dt> +<dt><span><code>LANG</code></span></dt> +<dd><span id="index-LC_005fCTYPE-environment-variable"></span> +<span id="index-LANG-environment-variable-2"></span> +<span id="index-encoding-error"></span> +<span id="index-null-character"></span> <p>These variables specify the locale for the <code>LC_CTYPE</code> category, which determines the type of characters, e.g., which characters are whitespace. This category also determines the character encoding. -See <a href="Character-Encoding.html#Character-Encoding">Character Encoding</a>. +See <a href="Character-Encoding.html">Character Encoding</a>. </p> </dd> -<dt><code>LANGUAGE</code></dt> -<dt><code>LC_ALL</code></dt> -<dt><code>LC_MESSAGES</code></dt> -<dt><code>LANG</code></dt> -<dd><a name="index-LANGUAGE-environment-variable-1"></a> -<a name="index-LC_005fALL-environment-variable-3"></a> -<a name="index-LC_005fMESSAGES-environment-variable-1"></a> -<a name="index-LANG-environment-variable-3"></a> -<a name="index-language-of-messages"></a> -<a name="index-message-language"></a> -<a name="index-national-language-support-1"></a> -<a name="index-translation-of-message-language"></a> +<dt id='index-LANGUAGE-environment-variable-1'><span><code>LANGUAGE</code><a href='#index-LANGUAGE-environment-variable-1' class='copiable-anchor'> ¶</a></span></dt> +<dt><span><code>LC_ALL</code></span></dt> +<dt><span><code>LC_MESSAGES</code></span></dt> +<dt><span><code>LANG</code></span></dt> +<dd><span id="index-LC_005fALL-environment-variable-3"></span> +<span id="index-LC_005fMESSAGES-environment-variable-1"></span> +<span id="index-LANG-environment-variable-3"></span> +<span id="index-language-of-messages"></span> +<span id="index-message-language"></span> +<span id="index-national-language-support-1"></span> +<span id="index-translation-of-message-language"></span> <p>These variables specify the locale for the <code>LC_MESSAGES</code> category, which determines the language that <code>grep</code> uses for messages. The default ‘<samp>C</samp>’ locale uses American English messages. </p> </dd> -<dt><code>POSIXLY_CORRECT</code></dt> -<dd><a name="index-POSIXLY_005fCORRECT-environment-variable"></a> -<p>If set, <code>grep</code> behaves as POSIX requires; otherwise, +<dt id='index-POSIXLY_005fCORRECT-environment-variable'><span><code>POSIXLY_CORRECT</code><a href='#index-POSIXLY_005fCORRECT-environment-variable' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>If set, <code>grep</code> behaves as POSIX requires; otherwise, <code>grep</code> behaves more like other GNU programs. POSIX requires that options that @@ -346,9 +303,8 @@ invalid bracket expression. See <a href="Character-Classes-and-Bracket-Expressions.html#invalid_002dbracket_002dexpr">invalid-bracket-expr</a>. </p> </dd> -<dt><code>_<var>N</var>_GNU_nonoption_argv_flags_</code></dt> -<dd><a name="index-_005fN_005fGNU_005fnonoption_005fargv_005fflags_005f-environment-variable"></a> -<p>(Here <code><var>N</var></code> is <code>grep</code>’s numeric process ID.) +<dt id='index-_005fN_005fGNU_005fnonoption_005fargv_005fflags_005f-environment-variable'><span><code>_<var>N</var>_GNU_nonoption_argv_flags_</code><a href='#index-_005fN_005fGNU_005fnonoption_005fargv_005fflags_005f-environment-variable' class='copiable-anchor'> ¶</a></span></dt> +<dd><p>(Here <code><var>N</var></code> is <code>grep</code>’s numeric process ID.) If the <var>i</var>th character of this environment variable’s value is ‘<samp>1</samp>’, do not consider the <var>i</var>th operand of <code>grep</code> to be an option, even if it appears to be one. @@ -361,11 +317,26 @@ </dd> </dl> +<p>The <code>GREP_OPTIONS</code> environment variable of <code>grep</code> 2.20 and +earlier is no longer supported, as it caused problems when writing +portable scripts. To make arbitrary changes to how <code>grep</code> +works, you can use an alias or script instead. For example, if +<code>grep</code> is in the directory ‘<samp>/usr/bin</samp>’ you can prepend +<samp>$HOME/bin</samp> to your <code>PATH</code> and create an executable script +<samp>$HOME/bin/grep</samp> containing the following: +</p> +<div class="example"> +<pre class="example">#! /bin/sh +export PATH=/usr/bin +exec grep --color=auto --devices=skip "$@" +</pre></div> + +</div> <hr> <div class="header"> <p> -Next: <a href="Exit-Status.html#Exit-Status" accesskey="n" rel="next">Exit Status</a>, Previous: <a href="Command_002dline-Options.html#Command_002dline-Options" accesskey="p" rel="prev">Command-line Options</a>, Up: <a href="Invoking.html#Invoking" accesskey="u" rel="up">Invoking</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> +Next: <a href="Exit-Status.html">Exit Status</a>, Previous: <a href="Command_002dline-Options.html">Command-line Options</a>, Up: <a href="Invoking.html">Invoking <code>grep</code></a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p> </div>
