Hi,

I was trying to understand the part of the documentation on word
splitting. I realized that without some experiments:

https://gist.github.com/x-yuri/6c6b375e7b0721a323960baaedf2a649

I wasn't sure I understood it correctly. And one of the experiments
revealed that:

$ bash -c 'IFS=x; a=xa; f() { for arg; do echo "($arg)"; done; }; f $a'
()
(a)

$ bash -c 'IFS=x; a=ax; f() { for arg; do echo "($arg)"; done; }; f $a'
(a)

$ bash --version
GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)

I.e. IFS non-whitespaces are not stripped at the beginning of a word,
but if there's one such non-whitespace at the end, it is stripped.
This looks like a bug, unless I'm missing something.

Regards,
Yuri

Reply via email to