Re: IFS is ignored when concatenating array elements

2015-03-15 Thread isabella parakiss
On 3/14/15, Le Manh Cuong wrote: > In bash, you need to quote in second arr assignment: > $ arr=(a b c); IFS=+; arr="${arr[*]/a/x}"; echo "$arr"x+b+c > A note that the result from those shells are different. After second > assignment to arr: > - In bash and ksh, arr still be an array, contain 3 el

Re: IFS is ignored when concatenating array elements

2015-03-14 Thread Chet Ramey
On 3/13/15 6:15 PM, isabella parakiss wrote: > This works as I would expect: > > $ arr=(a b c); IFS=+; echo "${arr[*]/a/x}" > x+b+c > > > But for some reason, this ignores IFS: > > $ arr=(a b c); IFS=+; arr=${arr[*]/a/x}; echo "$arr" > x b c Because it doesn't occur within a double-quoted stri