[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $IFS and "${array[@]:offset}"
From: |
Stephane Chazelas |
Subject: |
Re: $IFS and "${array[@]:offset}" |
Date: |
Fri, 6 Jun 2008 10:02:25 +0100 |
User-agent: |
Mutt/1.5.16 (2007-09-19) |
On Thu, Jun 05, 2008 at 05:39:58PM +0100, Stephane Chazelas wrote:
[...]
> $ bash -c 'printf "%s\n" "${@:2}"' x 1 2 "3 4" 5
> 2
> 3 4
> 5
> $ bash -c 'IFS=a; printf "%s\n" "${@:2}"' 0 1 2 "3 4" 5
> 2 3 4 5
>
> I don't understand why $IFS would have any influence here. The
> behavior differs from ksh.
>
> It seems that you need to have " " in IFS or IFS being unset for
> it to work as I would expect.
[...]
It's the same for "${@//a/b}":
$ bash -c 'printf "<%s>\n" "${@//a/b}"' x a b c
<b>
<b>
<c>
$ bash -c 'IFS=a; printf "<%s>\n" "${@//a/b}"' x a
b c
<b b c>
--
Stéphane
- Re: $IFS and "${array[@]:offset}",
Stephane Chazelas <=