Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Unsetting Array
- X-seq: zsh-users 13553
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Unsetting Array
- Date: Tue, 09 Dec 2008 14:18:34 +0000
- In-reply-to: <54348.153.98.68.197.1228831457.squirrel@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <54348.153.98.68.197.1228831457.squirrel@xxxxxxxxxxxxxxxxxxx>
"Jerry Rocteur" wrote:
> I'm using ZSH_VERION 4.2.6 on Redhat 5 to test some Korn shell scripts.
>
> Note that /usr/bin/ksh is a link to /bin/zsh
>
> I am unsetting an array like this unset variable[$i] and get
>..
> What is the correct way to unset an array element.
You can't strictly *unset* an element to an array. In zsh, an array is
always a set of strings that has a particular length. So what you can
do is limited to changing the length of the array or setting an element
of the array to be an empty string. The latter is probably nearest to
what you want, but (in places where it makes a difference) the shell
will always treat the empty element as a string with zero length, not as
an unset parameter. The syntax for that is
variable[$i]=
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author