[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: IFS as the control variable in a for loop
From: |
Chet Ramey |
Subject: |
Re: IFS as the control variable in a for loop |
Date: |
Sun, 8 May 2016 20:24:16 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.0 |
On 5/2/16 3:06 PM, Grisha Levit wrote:
> When in a non-interactive shell, IFS, when modified as the control variable
> in a for loop does not change splitting behavior.
> $ bash -c 'for IFS in .; do printf "%s\n" "$IFS" "$*"; done' bash x x
> .
> x x
>
> $ bash -ic 'for IFS in .; do printf "%s\n" "$IFS" "$*"; done' bash x x
> .
> x.x
Thanks for the report; this is an easy fix. The fix will be in bash-4.4.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/