Re: IFS as the control variable in a for loop

2016-05-08 Thread Chet Ramey
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, CWRUc...@case.eduhttp://cnswww.cns.cwru.edu/~chet/



IFS as the control variable in a for loop

2016-05-02 Thread Grisha Levit
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