[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: One IFS non-whitespace is stripped at the end of a word during word
From: |
Greg Wooledge |
Subject: |
Re: One IFS non-whitespace is stripped at the end of a word during word splitting |
Date: |
Sun, 8 Dec 2024 09:05:38 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Dec 08, 2024 at 10:27:33 +0200, Yuri Kanivetsky wrote:
> $ bash -c 'IFS=x; a=ax; f() { for arg; do echo "($arg)"; done; }; f $a'
> (a)
Another responder has already given an explanation, but just for
redundancy: <https://mywiki.wooledge.org/BashPitfalls#pf47>
The good news is that there's a workaround. The bad news is that
you have to remember to use it every time.