[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it possible or RFE to expand ranges of *arrays*
From: |
Maarten Billemont |
Subject: |
Re: Is it possible or RFE to expand ranges of *arrays* |
Date: |
Thu, 26 Apr 2012 17:59:51 +0200 |
On 26 Apr 2012, at 06:30, John Kearney wrote:
> Am 26.04.2012 06:26, schrieb Linda Walsh:
>> I know I can get
>> a="abcdef" echo "${a[2:4]}" = cde
>>
>> how do I do:
>> typeset -a a=(apple berry cherry date); then get:
>>
>> echo ${a[1:2]} = "berry" "cherry" ( non-grouped args)
>>
>> I tried to do it in a function and hurt myself.
>>
>>
>>
> echo ${a[@]:1:2}
>
I see little reason to ask bash to wordsplit the elements after expanding them.
You ought to quote that expansion.
smime.p7s
Description: S/MIME cryptographic signature