I think I have found answers to my questions (for the last two questions, thanks to this webpage ).
1. What is a static string?
This is not accurate wording. But I think it means a "literal" string.
2. What is the difference between expansion and word splitting?
Exapansion refers to: Brace expansion, Tilde expansion, Shell parameter and variable expansion (this involves using $
symbol), command substitution, arithmetric expansion, process substitution, Word splitting, and File name expansion.
So the word splitting is a special case of expansion and to quote the webpage above:
The shell scans the results of parameter expansion, command substitution, and arithmetic expansion that did not occur within double quotes for word splitting.
The shell treats each character of $IFS as a delimiter, and splits the results of the other expansions into words on these characters. If IFS is unset, or its value is exactly "''", the default, then any sequence of IFS characters serves to delimit words. If IFS has a value other than the default, then sequences of the whitespace characters "space" and "Tab" are ignored at the beginning and end of the word, as long as the whitespace character is in the value of IFS (an IFS whitespace character). Any character in IFS that is not IFS whitespace, along with any adjacent IF whitespace characters, delimits a field. A sequence of IFS whitespace characters is also treated as a delimiter. If the value of IFS is null, no word splitting occurs.
Explicit null arguments ("""" or "''") are retained. 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.
But the important thing to remember is:
️ If no expansion occurs, no splitting is performed. ️
3. The third question is answered by question 2.
i=1:2:3; echo "$i"
would output1:2:3
regardless ofIFS
, whilei=1:2:3; echo $i
would output1 2 3
ifIFS=:
. Your loop does nothing apart from assigning1:2:3
toi
. – Kusalananda Dec 19 '21 at 22:13