bash: Word Splitting

1 
1 3.5.7 Word Splitting
1 --------------------
1 
1 The shell scans the results of parameter expansion, command
1 substitution, and arithmetic expansion that did not occur within double
1 quotes for word splitting.
1 
1    The shell treats each character of '$IFS' as a delimiter, and splits
1 the results of the other expansions into words using these characters as
1 field terminators.  If 'IFS' is unset, or its value is exactly
1 '<space><tab><newline>', the default, then sequences of ' <space>',
1 '<tab>', and '<newline>' at the beginning and end of the results of the
1 previous expansions are ignored, and any sequence of 'IFS' characters
1 not at the beginning or end serves to delimit words.  If 'IFS' has a
1 value other than the default, then sequences of the whitespace
1 characters 'space', 'tab', and 'newline' are ignored at the beginning
1 and end of the word, as long as the whitespace character is in the value
1 of 'IFS' (an 'IFS' whitespace character).  Any character in 'IFS' that
1 is not 'IFS' whitespace, along with any adjacent 'IFS' whitespace
1 characters, delimits a field.  A sequence of 'IFS' whitespace characters
1 is also treated as a delimiter.  If the value of 'IFS' is null, no word
1 splitting occurs.
1 
1    Explicit null arguments ('""' or '''') are retained and passed to
1 commands as empty strings.  Unquoted implicit null arguments, resulting
1 from the expansion of parameters that have no values, are removed.  If a
1 parameter with no value is expanded within double quotes, a null
1 argument results and is retained and passed to a command as an empty
1 string.  When a quoted null argument appears as part of a word whose
1 expansion is non-null, the null argument is removed.  That is, the word
1 '-d''' becomes '-d' after word splitting and null argument removal.
1 
1    Note that if no expansion occurs, no splitting is performed.
1