diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/bash/word-splitting.html | |
new repository
Diffstat (limited to 'devdocs/bash/word-splitting.html')
| -rw-r--r-- | devdocs/bash/word-splitting.html | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/devdocs/bash/word-splitting.html b/devdocs/bash/word-splitting.html new file mode 100644 index 00000000..39bc6fe9 --- /dev/null +++ b/devdocs/bash/word-splitting.html @@ -0,0 +1,6 @@ +<h1 class="subsection">Word Splitting</h1> <p>The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting. </p> <p>The shell treats each character of <code>$IFS</code> as a delimiter, and splits the results of the other expansions into words using these characters as field terminators. If <code>IFS</code> is unset, or its value is exactly <code><space><tab><newline></code>, the default, then sequences of <code> <space></code>, <code><tab></code>, and <code><newline></code> at the beginning and end of the results of the previous expansions are ignored, and any sequence of <code>IFS</code> characters not at the beginning or end serves to delimit words. If <code>IFS</code> has a value other than the default, then sequences of the whitespace characters <code>space</code>, <code>tab</code>, and <code>newline</code> are ignored at the beginning and end of the word, as long as the whitespace character is in the value of <code>IFS</code> (an <code>IFS</code> whitespace character). Any character in <code>IFS</code> that is not <code>IFS</code> whitespace, along with any adjacent <code>IFS</code> whitespace characters, delimits a field. A sequence of <code>IFS</code> whitespace characters is also treated as a delimiter. If the value of <code>IFS</code> is null, no word splitting occurs. </p> <p>Explicit null arguments (<code>""</code> or <code>''</code>) are retained and passed to commands as empty strings. Unquoted implicit null arguments, resulting from the expansion of parameters that have no values, are removed. If a parameter with no value is expanded within double quotes, a null argument results and is retained and passed to a command as an empty string. When a quoted null argument appears as part of a word whose expansion is non-null, the null argument is removed. That is, the word <code>-d''</code> becomes <code>-d</code> after word splitting and null argument removal. </p> <p>Note that if no expansion occurs, no splitting is performed. </p><div class="_attribution"> + <p class="_attribution-p"> + Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br> + <a href="https://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html</a> + </p> +</div> |
