Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: let unset array element remove compatible with bash
- X-seq: zsh-workers 30250
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: let unset array element remove compatible with bash
- Date: Tue, 21 Feb 2012 21:01:06 -0800
- In-reply-to: <CAPg-njyehwyETKY4KGdFV8u_ZwkMku-G9xVi7d7PpU9rZhdPDA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAPg-njyehwyETKY4KGdFV8u_ZwkMku-G9xVi7d7PpU9rZhdPDA@mail.gmail.com>
[Moved to -workers for discussion]
On Feb 22, 3:28am, Daniel Lin wrote:
}
} Can any developer consider to enhance zsh's function like "unset var[2]"?
Hmm, what's the reason NOT to do this? I can think of one: "unset var[9]"
might cause elements 2 through 8 to spring into existence, which is surely
counter-intuitive ... but of course the same thing happens with var[9]=().
@@ -3049,8 +3063,14 @@
}
paramtab = tht;
} else {
- zerrnam(name, "%s: invalid element for unset", s);
- returnval = 1;
+ char *arr[1]; arr[0] = 0;
+ *ss = '[';
+ if (assignaparam(s, zarrdup(arr), 0)) {
+ returnval = 0;
+ } else {
+ zerrnam(name, "%s: invalid element for unset", s);
+ returnval = 1;
+ }
}
} else {
if (unsetparam_pm(pm, 0, 1))
Messages sorted by:
Reverse Date,
Date,
Thread,
Author