bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where is the syntax of ${array[@]:1:2} described?


From: Chet Ramey
Subject: Re: Where is the syntax of ${array[@]:1:2} described?
Date: Thu, 08 Jul 2010 23:30:14 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.7) Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1

On 7/8/10 10:27 PM, Peng Yu wrote:
> Hi,
> 
> array=(a b c)
> echo ${array[@]:1:2}
> 
> 
> I'm looking for the document for the above usage. I checked the Arrays
> section of man bash, but I don't see a description of such usage. I
> also searched man bash with [0-9]+:[0-9]+. But I still don't find a
> description. Could anybody let me know where this is documented?

In substring expansion:

                  If parameter is @, the result is length  posi-
tional  parameters  beginning  at  offset.   If  parameter is an
indexed array name subscripted by @ or  *,  the  result  is  the
length members of the array beginning with ${parameter[offset]}.

-- 
``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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]