From the bash man page for the
One line is read from the standard input, or from the file descriptor fd supplied as an argument to the -u option, split into words as described above under Word Splitting, and the first word is assigned to the first name,...
Now I tried out the following:
IFS=, echo ' a b,c d'|read -n 4 x y echo ".$x. .$y."
I expected the output to be
. a b. .c d.
becaus due to the change, word splitting should occur at the comma instead of the space, but the actual output was
This puzzles me. The
.a. looks like word splitting is still done at spaces, but then at least,
y should be set to
b, not being empty.
I can't help but feeling that I misunderstand the explanations in the man-page about the
BTW, I'm using bash 4.4.12.