Good day Chet, list - I'm concerned about the difference in output of these functions with the example input given on the '$' prefixed line below (with 4.2.29(2)-release (x86_64-unknown-linux-gnu)):
function count_args { v=($@); echo ${#v[@]}; } function count_colons { IFS=':' ; v=($@); echo ${#v[@]}; } $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3\:4) 3 4 It appears to be impossible for an item delimited by 'X' to contain an escaped 'X' ('\X') if 'X' is not a standard delimiter (' ', '<TAB>') . Quoting doesn't seem to help either: $ echo $(count_args 1 2 3\ 4) $(count_colons 1:2:3':4') 3 4 To me, this appears to be a bug. But I bet you're going to tell me it is a feature ? Please explain. Thanks & Regards, Jason BTW, documentation on $IFS does not appear to mention this issue: Word Splitting 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 <space><tab><newline>, the default, then sequences of <space>, <tab>, and <newline> at the beginning and end of the results of the previous expansions are ignored, and any sequence of IFS charac- ters not at the beginning or end 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 IFS 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.