If IFS is for example <tab>
, then consecutive delimiters are merged by read-command. Otherwise that does not happen. Example:
$ echo -e 'zero\tone\ttwo\tthree' | while IFS=$'\t' read -a x; do echo "${x[2]}"; done
two
$ echo -e 'zero\t\tone\ttwo\tthree' | while IFS=$'\t' read -a x; do echo "${x[2]}"; done
two
$ echo -e 'zero§one§two§three' | while IFS=§ read -a x; do echo "${x[2]}"; done
two
$ echo -e 'zero§§one§two§three' | while IFS=§ read -a x; do echo "${x[2]}"; done
one
But why is this so?