CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 23/03/22 22:55:22
Index: html_node/Environment-Variables.html =================================================================== RCS file: /webcvs/grep/grep/manual/html_node/Environment-Variables.html,v retrieving revision 1.33 retrieving revision 1.34 diff -u -b -r1.33 -r1.34 --- html_node/Environment-Variables.html 3 Sep 2022 19:33:14 -0000 1.33 +++ html_node/Environment-Variables.html 23 Mar 2023 02:55:21 -0000 1.34 @@ -1,11 +1,11 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!DOCTYPE html> <html> -<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ --> +<!-- Created by GNU Texinfo 7.0dev, 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-2022 Free Software Foundation, +Copyright © 1999-2002, 2005, 2008-2023 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.8)</title> +<title>Environment Variables (GNU Grep 3.10)</title> -<meta name="description" content="Environment Variables (GNU Grep 3.8)"> -<meta name="keywords" content="Environment Variables (GNU Grep 3.8)"> +<meta name="description" content="Environment Variables (GNU Grep 3.10)"> +<meta name="keywords" content="Environment Variables (GNU Grep 3.10)"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> @@ -31,21 +31,10 @@ <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} -div.display {margin-left: 3.2em} +a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em} div.example {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} -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} +span.r {font-family: initial; font-weight: normal; font-style: normal} +span:hover a.copiable-link {visibility: visible} --> </style> <link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css"> @@ -54,67 +43,68 @@ </head> <body lang="en"> -<div class="section" id="Environment-Variables"> -<div class="header"> +<div class="section-level-extent" id="Environment-Variables"> +<div class="nav-panel"> <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> +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 class="command">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> -<span id="Environment-Variables-1"></span><h3 class="section">2.2 Environment Variables</h3> +<h3 class="section" id="Environment-Variables-1"><span>2.2 Environment Variables<a class="copiable-link" href="#Environment-Variables-1"> ¶</a></span></h3> -<p>The behavior of <code>grep</code> is affected by several environment +<p>The behavior of <code class="command">grep</code> is affected by several environment variables, the most important of which control the locale, which -specifies how <code>grep</code> interprets characters in its patterns and +specifies how <code class="command">grep</code> interprets characters in its patterns and data. </p> -<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 --> +<a class="index-entry-id" id="index-LANGUAGE-environment-variable"></a> +<a class="index-entry-id" id="index-LC_005fALL-environment-variable"></a> +<a class="index-entry-id" id="index-LC_005fMESSAGES-environment-variable"></a> +<a class="index-entry-id" id="index-LANG-environment-variable"></a> +<p>The locale for category <code class="code">LC_<var class="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>, +<code class="env">LC_ALL</code>, <code class="env">LC_<var class="var">foo</var></code><!-- /@w -->, and <code class="env">LANG</code>, in that order. The first of these variables that is set specifies the locale. -For example, if <code>LC_ALL</code> is not set, -but <code>LC_COLLATE</code> is set to ‘<samp>pt_BR.UTF-8</samp>’, +For example, if <code class="env">LC_ALL</code> is not set, +but <code class="env">LC_COLLATE</code> is set to ‘<samp class="samp">pt_BR.UTF-8</samp>’, then a Brazilian Portuguese locale is used -for the <code>LC_COLLATE</code> category. -As a special case for <code>LC_MESSAGES</code> only, the environment variable -<code>LANGUAGE</code> can contain a colon-separated list of languages that +for the <code class="env">LC_COLLATE</code> category. +As a special case for <code class="env">LC_MESSAGES</code> only, the environment variable +<code class="env">LANGUAGE</code> can contain a colon-separated list of languages that overrides the three environment variables that ordinarily specify -the <code>LC_MESSAGES</code> category. -The ‘<samp>C</samp>’ locale is used if none of these environment variables are set, +the <code class="env">LC_MESSAGES</code> category. +The ‘<samp class="samp">C</samp>’ locale is used if none of these environment variables are set, if the locale catalog is not installed, -or if <code>grep</code> was not compiled +or if <code class="command">grep</code> was not compiled with national language support (NLS). -The shell command <code>locale -a</code> lists locales that are currently available. +The shell command <code class="code">locale -a</code> lists locales that are currently available. </p> -<span id="index-environment-variables"></span> -<p>The following environment variables affect the behavior of <code>grep</code>. +<a class="index-entry-id" id="index-environment-variables"></a> +<p>The following environment variables affect the behavior of <code class="command">grep</code>. </p> -<dl compact="compact"> -<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 obsolescent variable interacts with <code>GREP_COLORS</code> -confusingly, and <code>grep</code> warns if it is set and is not -overridden by <code>GREP_COLORS</code>. Instead of -‘<samp>GREP_COLOR='<var>color</var>'</samp>’, you can use -‘<samp>GREP_COLORS='mt=<var>color</var>'</samp>’. -</p> -</dd> -<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 -that defaults to ‘<samp>ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36</samp>’ -with the ‘<samp>rv</samp>’ and ‘<samp>ne</samp>’ boolean capabilities omitted (i.e., false). +<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> +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. +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). The two-letter capability names refer to terminal “capabilities,” the ability of a terminal to highlight text, or change its color, and so on. These capabilities are stored in an online database and accessed by -the <code>terminfo</code> library. +the <code class="code">terminfo</code> library. Non-empty capability values control highlighting using Select Graphic Rendition (SGR) @@ -125,171 +115,186 @@ for permitted values and their meanings as character attributes.) These substring values are integers in decimal representation and can be concatenated with semicolons. -<code>grep</code> takes care of assembling the result -into a complete SGR sequence (‘<samp>\33[</samp>’...‘<samp>m</samp>’). +<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>’). Common values to concatenate include -‘<samp>1</samp>’ for bold, -‘<samp>4</samp>’ for underline, -‘<samp>5</samp>’ for blink, -‘<samp>7</samp>’ for inverse, -‘<samp>39</samp>’ for default foreground color, -‘<samp>30</samp>’ to ‘<samp>37</samp>’ for foreground colors, -‘<samp>90</samp>’ to ‘<samp>97</samp>’ for 16-color mode foreground colors, -‘<samp>38;5;0</samp>’ to ‘<samp>38;5;255</samp>’ +‘<samp class="samp">1</samp>’ for bold, +‘<samp class="samp">4</samp>’ for underline, +‘<samp class="samp">5</samp>’ for blink, +‘<samp class="samp">7</samp>’ for inverse, +‘<samp class="samp">39</samp>’ for default foreground color, +‘<samp class="samp">30</samp>’ to ‘<samp class="samp">37</samp>’ for foreground colors, +‘<samp class="samp">90</samp>’ to ‘<samp class="samp">97</samp>’ for 16-color mode foreground colors, +‘<samp class="samp">38;5;0</samp>’ to ‘<samp class="samp">38;5;255</samp>’ for 88-color and 256-color modes foreground colors, -‘<samp>49</samp>’ for default background color, -‘<samp>40</samp>’ to ‘<samp>47</samp>’ for background colors, -‘<samp>100</samp>’ to ‘<samp>107</samp>’ for 16-color mode background colors, -and ‘<samp>48;5;0</samp>’ to ‘<samp>48;5;255</samp>’ +‘<samp class="samp">49</samp>’ for default background color, +‘<samp class="samp">40</samp>’ to ‘<samp class="samp">47</samp>’ for background colors, +‘<samp class="samp">100</samp>’ to ‘<samp class="samp">107</samp>’ for 16-color mode background colors, +and ‘<samp class="samp">48;5;0</samp>’ to ‘<samp class="samp">48;5;255</samp>’ for 88-color and 256-color modes background colors. </p> <p>Supported capabilities are as follows. </p> -<dl compact="compact"> -<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 +<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 (i.e., -matching lines when the <samp>-v</samp> command-line option is omitted, -or non-matching lines when <samp>-v</samp> is specified). -If however the boolean ‘<samp>rv</samp>’ capability -and the <samp>-v</samp> command-line option are both specified, +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). +If however the boolean ‘<samp class="samp">rv</samp>’ capability +and the <samp class="option">-v</samp> command-line option are both specified, it applies to context matching lines instead. The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<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 +<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 (i.e., -non-matching lines when the <samp>-v</samp> command-line option is omitted, -or matching lines when <samp>-v</samp> is specified). -If however the boolean ‘<samp>rv</samp>’ capability -and the <samp>-v</samp> command-line option are both specified, +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). +If however the boolean ‘<samp class="samp">rv</samp>’ capability +and the <samp class="option">-v</samp> command-line option are both specified, it applies to selected non-matching lines instead. The default is empty (i.e., the terminal’s default color pair). </p> </dd> -<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. +<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 +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 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 +<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 (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). -Setting this is equivalent to setting both ‘<samp>ms=</samp>’ and ‘<samp>mc=</samp>’ +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). +Setting this is equivalent to setting both ‘<samp class="samp">ms=</samp>’ and ‘<samp class="samp">mc=</samp>’ at once to the same value. The default is a bold red text foreground over the current line background. </p> </dd> -<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 +<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. +(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 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 +<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. +(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 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. +<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. The default is a magenta text foreground over the terminal’s default background. </p> </dd> -<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. +<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. The default is a green text foreground over the terminal’s default background. </p> </dd> -<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. +<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. The default is a green text foreground over the terminal’s default background. </p> </dd> -<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>’), +<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 +between selected line fields (‘<samp class="samp">:</samp>’), +between context line fields (‘<samp class="samp">-</samp>’), and between groups of adjacent lines -when nonzero context is specified (‘<samp>--</samp>’). +when nonzero context is specified (‘<samp class="samp">--</samp>’). The default is a cyan text foreground over the terminal’s default background. </p> </dd> -<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>’) +<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 +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. It is otherwise useful on terminals -for which the <code>back_color_erase</code> -(<code>bce</code>) boolean <code>terminfo</code> capability does not apply, +for which the <code class="code">back_color_erase</code> +(<code class="code">bce</code>) boolean <code class="code">terminfo</code> capability does not apply, when the chosen highlight colors do not affect the background, or when EL is too slow or causes too much flicker. The default is false (i.e., the capability is omitted). </p></dd> </dl> -<p>Note that boolean capabilities have no ‘<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 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 +<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> +<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, +which might affect how range expressions like ‘<samp class="samp">a-z</samp>’ are interpreted. </p> </dd> -<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, +<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> +<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, 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</a>. +See <a class="xref" href="Character-Encoding.html">Character Encoding</a>. </p> </dd> -<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 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. +<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> +<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, +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, +<code class="command">grep</code> behaves more like other GNU programs. POSIX requires that options that follow file names must be treated as file names; @@ -298,35 +303,24 @@ and are treated as options. </p> </dd> -<dt id='index-TERM-environment-variable'><span><code>TERM</code><a href='#index-TERM-environment-variable' class='copiable-anchor'> ¶</a></span></dt> -<dd><p>This variable specifies the output terminal type, which can affect -what the <samp>--color</samp> option does. See <a href="General-Output-Control.html">General Output Control</a>. -</p> -</dd> -<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. -A shell can put this variable in the environment for each command it runs, -specifying which operands are the results of file name wildcard expansion -and therefore should not be treated as options. -This behavior is available only with the GNU C library, -and only when <code>POSIXLY_CORRECT</code> is not set. +<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 +what the <samp class="option">--color</samp> option does. See <a class="xref" href="General-Output-Control.html">General Output Control</a>. </p> </dd> </dl> -<p>The <code>GREP_OPTIONS</code> environment variable of <code>grep</code> 2.20 and +<p>The <code class="env">GREP_OPTIONS</code> environment variable of <code class="command">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> +portable scripts. To make arbitrary changes to how <code class="command">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: +<code class="command">grep</code> is in the directory ‘<samp class="samp">/usr/bin</samp>’ you can prepend +<samp class="file">$HOME/bin</samp> to your <code class="env">PATH</code> and create an executable script +<samp class="file">$HOME/bin/grep</samp> containing the following: </p> <div class="example"> -<pre class="example">#! /bin/sh +<pre class="example-preformatted">#! /bin/sh export PATH=/usr/bin exec grep --color=auto --devices=skip "$@" </pre></div> @@ -334,9 +328,9 @@ </div> <hr> -<div class="header"> +<div class="nav-panel"> <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> +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 class="command">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>
