CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 25/04/11 13:06:09
Index: html_node/Environment-Variables.html =================================================================== RCS file: /webcvs/grep/grep/manual/html_node/Environment-Variables.html,v retrieving revision 1.35 retrieving revision 1.36 diff -u -b -r1.35 -r1.36 --- html_node/Environment-Variables.html 13 May 2023 09:23:52 -0000 1.35 +++ html_node/Environment-Variables.html 11 Apr 2025 17:06:07 -0000 1.36 @@ -1,11 +1,11 @@ <!DOCTYPE html> <html> -<!-- Created by GNU Texinfo 7.0dev, https://www.gnu.org/software/texinfo/ --> +<!-- Created by GNU Texinfo 7.1.1, 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 © 1999-2002, 2005, 2008-2023 Free Software Foundation, +Copyright © 1999-2002, 2005, 2008-2025 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document @@ -14,10 +14,10 @@ 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". --> -<title>Environment Variables (GNU Grep 3.11)</title> +<title>Environment Variables (GNU Grep 3.12)</title> -<meta name="description" content="Environment Variables (GNU Grep 3.11)"> -<meta name="keywords" content="Environment Variables (GNU Grep 3.11)"> +<meta name="description" content="Environment Variables (GNU Grep 3.12)"> +<meta name="keywords" content="Environment Variables (GNU Grep 3.12)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> @@ -33,7 +33,6 @@ <!-- a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em} div.example {margin-left: 3.2em} -span.r {font-family: initial; font-weight: normal; font-style: normal} span:hover a.copiable-link {visibility: visible} --> </style> @@ -83,20 +82,18 @@ <p>The following environment variables affect the behavior of <code class="command">grep</code>. </p> <dl class="table"> -<dt><code class="env">GREP_COLOR</code></dt> -<dd><a class="index-entry-id" id="index-GREP_005fCOLOR-environment-variable"></a> -<a class="index-entry-id" id="index-highlight-markers"></a> -<p>This obsolescent variable interacts with <code class="env">GREP_COLORS</code> +<dt><a class="index-entry-id" id="index-highlight-markers"></a> +<a id="index-GREP_005fCOLOR-environment-variable"></a><span><code class="env">GREP_COLOR</code><a class="copiable-link" href="#index-GREP_005fCOLOR-environment-variable"> ¶</a></span></dt> +<dd><p>This obsolescent variable interacts with <code class="env">GREP_COLORS</code> confusingly, and <code class="command">grep</code> warns if it is set and is not overridden by <code class="env">GREP_COLORS</code>. Instead of ‘<samp class="samp">GREP_COLOR='<var class="var">color</var>'</samp>’, you can use ‘<samp class="samp">GREP_COLORS='mt=<var class="var">color</var>'</samp>’. </p> </dd> -<dt><code class="env">GREP_COLORS</code></dt> -<dd><a class="index-entry-id" id="index-GREP_005fCOLORS-environment-variable"></a> -<a class="index-entry-id" id="index-highlight-markers-1"></a> -<p>This variable controls how the <samp class="option">--color</samp> option highlights output. +<dt><a class="index-entry-id" id="index-highlight-markers-1"></a> +<a id="index-GREP_005fCOLORS-environment-variable"></a><span><code class="env">GREP_COLORS</code><a class="copiable-link" href="#index-GREP_005fCOLORS-environment-variable"> ¶</a></span></dt> +<dd><p>This variable controls how the <samp class="option">--color</samp> option highlights output. Its value is a colon-separated list of <code class="code">terminfo</code> capabilities that defaults to ‘<samp class="samp">ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36</samp>’ with the ‘<samp class="samp">rv</samp>’ and ‘<samp class="samp">ne</samp>’ boolean capabilities omitted (i.e., false). @@ -116,7 +113,7 @@ These substring values are integers in decimal representation and can be concatenated with semicolons. <code class="command">grep</code> takes care of assembling the result -into a complete SGR sequence (‘<samp class="samp">\33[</samp>’...‘<samp class="samp">m</samp>’). +into a complete SGR sequence (‘<samp class="samp">\33[</samp>’…‘<samp class="samp">m</samp>’). Common values to concatenate include ‘<samp class="samp">1</samp>’ for bold, ‘<samp class="samp">4</samp>’ for underline, @@ -136,9 +133,8 @@ <p>Supported capabilities are as follows. </p> <dl class="table"> -<dt><code class="code">sl=</code></dt> -<dd><a class="index-entry-id" id="index-sl-GREP_005fCOLORS-capability"></a> -<p>SGR substring for whole selected lines +<dt><a id="index-sl-GREP_005fCOLORS-capability"></a><span><code class="code">sl=</code><a class="copiable-link" href="#index-sl-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>SGR substring for whole selected lines (i.e., matching lines when the <samp class="option">-v</samp> command-line option is omitted, or non-matching lines when <samp class="option">-v</samp> is specified). @@ -148,9 +144,8 @@ The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<dt><code class="code">cx=</code></dt> -<dd><a class="index-entry-id" id="index-cx-GREP_005fCOLORS-capability"></a> -<p>SGR substring for whole context lines +<dt><a id="index-cx-GREP_005fCOLORS-capability"></a><span><code class="code">cx=</code><a class="copiable-link" href="#index-cx-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>SGR substring for whole context lines (i.e., non-matching lines when the <samp class="option">-v</samp> command-line option is omitted, or matching lines when <samp class="option">-v</samp> is specified). @@ -160,17 +155,15 @@ The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<dt><code class="code">rv</code></dt> -<dd><a class="index-entry-id" id="index-rv-GREP_005fCOLORS-capability"></a> -<p>Boolean value that reverses (swaps) the meanings of +<dt><a id="index-rv-GREP_005fCOLORS-capability"></a><span><code class="code">rv</code><a class="copiable-link" href="#index-rv-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>Boolean value that reverses (swaps) the meanings of the ‘<samp class="samp">sl=</samp>’ and ‘<samp class="samp">cx=</samp>’ capabilities when the <samp class="option">-v</samp> command-line option is specified. The default is false (i.e., the capability is omitted). </p> </dd> -<dt><code class="code">mt=01;31</code></dt> -<dd><a class="index-entry-id" id="index-mt-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in any matching line +<dt><a id="index-mt-GREP_005fCOLORS-capability"></a><span><code class="code">mt=01;31</code><a class="copiable-link" href="#index-mt-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in any matching line (i.e., a selected line when the <samp class="option">-v</samp> command-line option is omitted, or a context line when <samp class="option">-v</samp> is specified). @@ -179,45 +172,39 @@ The default is a bold red text foreground over the current line background. </p> </dd> -<dt><code class="code">ms=01;31</code></dt> -<dd><a class="index-entry-id" id="index-ms-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in a selected line. +<dt><a id="index-ms-GREP_005fCOLORS-capability"></a><span><code class="code">ms=01;31</code><a class="copiable-link" href="#index-ms-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in a selected line. (This is used only when the <samp class="option">-v</samp> command-line option is omitted.) The effect of the ‘<samp class="samp">sl=</samp>’ (or ‘<samp class="samp">cx=</samp>’ if ‘<samp class="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 class="code">mc=01;31</code></dt> -<dd><a class="index-entry-id" id="index-mc-GREP_005fCOLORS-capability"></a> -<p>SGR substring for matching non-empty text in a context line. +<dt><a id="index-mc-GREP_005fCOLORS-capability"></a><span><code class="code">mc=01;31</code><a class="copiable-link" href="#index-mc-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>SGR substring for matching non-empty text in a context line. (This is used only when the <samp class="option">-v</samp> command-line option is specified.) The effect of the ‘<samp class="samp">cx=</samp>’ (or ‘<samp class="samp">sl=</samp>’ if ‘<samp class="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 class="code">fn=35</code></dt> -<dd><a class="index-entry-id" id="index-fn-GREP_005fCOLORS-capability"></a> -<p>SGR substring for file names prefixing any content line. +<dt><a id="index-fn-GREP_005fCOLORS-capability"></a><span><code class="code">fn=35</code><a class="copiable-link" href="#index-fn-GREP_005fCOLORS-capability"> ¶</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 class="code">ln=32</code></dt> -<dd><a class="index-entry-id" id="index-ln-GREP_005fCOLORS-capability"></a> -<p>SGR substring for line numbers prefixing any content line. +<dt><a id="index-ln-GREP_005fCOLORS-capability"></a><span><code class="code">ln=32</code><a class="copiable-link" href="#index-ln-GREP_005fCOLORS-capability"> ¶</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 class="code">bn=32</code></dt> -<dd><a class="index-entry-id" id="index-bn-GREP_005fCOLORS-capability"></a> -<p>SGR substring for byte offsets prefixing any content line. +<dt><a id="index-bn-GREP_005fCOLORS-capability"></a><span><code class="code">bn=32</code><a class="copiable-link" href="#index-bn-GREP_005fCOLORS-capability"> ¶</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 class="code">se=36</code></dt> -<dd><a class="index-entry-id" id="index-fn-GREP_005fCOLORS-capability-1"></a> -<p>SGR substring for separators that are inserted +<dt><a id="index-fn-GREP_005fCOLORS-capability-1"></a><span><code class="code">se=36</code><a class="copiable-link" href="#index-fn-GREP_005fCOLORS-capability-1"> ¶</a></span></dt> +<dd><p>SGR substring for separators that are inserted between selected line fields (‘<samp class="samp">:</samp>’), between context line fields (‘<samp class="samp">-</samp>’), and between groups of adjacent lines @@ -225,9 +212,8 @@ The default is a cyan text foreground over the terminal’s default background. </p> </dd> -<dt><code class="code">ne</code></dt> -<dd><a class="index-entry-id" id="index-ne-GREP_005fCOLORS-capability"></a> -<p>Boolean value that prevents clearing to the end of line +<dt><a id="index-ne-GREP_005fCOLORS-capability"></a><span><code class="code">ne</code><a class="copiable-link" href="#index-ne-GREP_005fCOLORS-capability"> ¶</a></span></dt> +<dd><p>Boolean value that prevents clearing to the end of line using Erase in Line (EL) to Right (‘<samp class="samp">\33[K</samp>’) each time a colorized item ends. This is needed on terminals on which EL is not supported. @@ -240,60 +226,56 @@ </p></dd> </dl> -<p>Note that boolean capabilities have no ‘<samp class="samp">=</samp>’... part. +<p>Note that boolean capabilities have no ‘<samp class="samp">=</samp>’… part. They are omitted (i.e., false) by default and become true when specified. </p> </dd> -<dt><code class="env">LC_ALL</code></dt> -<dt><code class="env">LC_COLLATE</code></dt> -<dt><code class="env">LANG</code></dt> -<dd><a class="index-entry-id" id="index-LC_005fALL-environment-variable-1"></a> -<a class="index-entry-id" id="index-LC_005fCOLLATE-environment-variable"></a> +<dt><a class="index-entry-id" id="index-LC_005fCOLLATE-environment-variable"></a> <a class="index-entry-id" id="index-LANG-environment-variable-1"></a> <a class="index-entry-id" id="index-character-type"></a> <a class="index-entry-id" id="index-national-language-support"></a> <a class="index-entry-id" id="index-NLS"></a> -<p>These variables specify the locale for the <code class="env">LC_COLLATE</code> category, +<a id="index-LC_005fALL-environment-variable-1"></a><span><code class="env">LC_ALL</code><a class="copiable-link" href="#index-LC_005fALL-environment-variable-1"> ¶</a></span></dt> +<dt><code class="env">LC_COLLATE</code></dt> +<dt><code class="env">LANG</code></dt> +<dd><p>These variables specify the locale for the <code class="env">LC_COLLATE</code> category, which might affect how range expressions like ‘<samp class="samp">a-z</samp>’ are interpreted. </p> </dd> -<dt><code class="env">LC_ALL</code></dt> -<dt><code class="env">LC_CTYPE</code></dt> -<dt><code class="env">LANG</code></dt> -<dd><a class="index-entry-id" id="index-LC_005fALL-environment-variable-2"></a> -<a class="index-entry-id" id="index-LC_005fCTYPE-environment-variable"></a> +<dt><a class="index-entry-id" id="index-LC_005fCTYPE-environment-variable"></a> <a class="index-entry-id" id="index-LANG-environment-variable-2"></a> <a class="index-entry-id" id="index-encoding-error"></a> <a class="index-entry-id" id="index-null-character"></a> -<p>These variables specify the locale for the <code class="env">LC_CTYPE</code> category, +<a id="index-LC_005fALL-environment-variable-2"></a><span><code class="env">LC_ALL</code><a class="copiable-link" href="#index-LC_005fALL-environment-variable-2"> ¶</a></span></dt> +<dt><code class="env">LC_CTYPE</code></dt> +<dt><code class="env">LANG</code></dt> +<dd><p>These variables specify the locale for the <code class="env">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 class="xref" href="Character-Encoding.html">Character Encoding</a>. </p> </dd> -<dt><code class="env">LANGUAGE</code></dt> -<dt><code class="env">LC_ALL</code></dt> -<dt><code class="env">LC_MESSAGES</code></dt> -<dt><code class="env">LANG</code></dt> -<dd><a class="index-entry-id" id="index-LANGUAGE-environment-variable-1"></a> -<a class="index-entry-id" id="index-LC_005fALL-environment-variable-3"></a> +<dt><a class="index-entry-id" id="index-LC_005fALL-environment-variable-3"></a> <a class="index-entry-id" id="index-LC_005fMESSAGES-environment-variable-1"></a> <a class="index-entry-id" id="index-LANG-environment-variable-3"></a> <a class="index-entry-id" id="index-language-of-messages"></a> <a class="index-entry-id" id="index-message-language"></a> <a class="index-entry-id" id="index-national-language-support-1"></a> <a class="index-entry-id" id="index-translation-of-message-language"></a> -<p>These variables specify the locale for the <code class="env">LC_MESSAGES</code> category, +<a id="index-LANGUAGE-environment-variable-1"></a><span><code class="env">LANGUAGE</code><a class="copiable-link" href="#index-LANGUAGE-environment-variable-1"> ¶</a></span></dt> +<dt><code class="env">LC_ALL</code></dt> +<dt><code class="env">LC_MESSAGES</code></dt> +<dt><code class="env">LANG</code></dt> +<dd><p>These variables specify the locale for the <code class="env">LC_MESSAGES</code> category, which determines the language that <code class="command">grep</code> uses for messages. The default ‘<samp class="samp">C</samp>’ locale uses American English messages. </p> </dd> -<dt><code class="env">POSIXLY_CORRECT</code></dt> -<dd><a class="index-entry-id" id="index-POSIXLY_005fCORRECT-environment-variable"></a> -<p>If set, <code class="command">grep</code> behaves as POSIX requires; otherwise, +<dt><a id="index-POSIXLY_005fCORRECT-environment-variable"></a><span><code class="env">POSIXLY_CORRECT</code><a class="copiable-link" href="#index-POSIXLY_005fCORRECT-environment-variable"> ¶</a></span></dt> +<dd><p>If set, <code class="command">grep</code> behaves as POSIX requires; otherwise, <code class="command">grep</code> behaves more like other GNU programs. POSIX requires that options that @@ -303,9 +285,8 @@ and are treated as options. </p> </dd> -<dt><code class="env">TERM</code></dt> -<dd><a class="index-entry-id" id="index-TERM-environment-variable"></a> -<p>This variable specifies the output terminal type, which can affect +<dt><a id="index-TERM-environment-variable"></a><span><code class="env">TERM</code><a class="copiable-link" href="#index-TERM-environment-variable"> ¶</a></span></dt> +<dd><p>This variable specifies the output terminal type, which can affect what the <samp class="option">--color</samp> option does. See <a class="xref" href="General-Output-Control.html">General Output Control</a>. </p> </dd>
