bug-bash
[Top][All Lists]
Advanced

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

Re: Negative array subscript with unset


From: Chet Ramey
Subject: Re: Negative array subscript with unset
Date: Sat, 12 Mar 2011 21:50:31 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7

On 3/12/11 7:21 PM, Chris F.A. Johnson wrote:
> 
>   I all versions I have tried, unsetting an array element using a
>   negative index fails:
> 
> $ array=( q w e r t y )
> $ unset 'array[-1]'
> bash: [-1]: bad array subscript

Negative subscripts only work with ${parameter[subscript]}.  The problem
is that I put the text in the manual page describing their use in the
wrong place.  It should have gone in the paragraph describing array
references.

Negative subscripts will work in more contexts in the next version of bash.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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