Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Can't overwrite $0 in functions anymore
- X-seq: zsh-workers 35464
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Can't overwrite $0 in functions anymore
- Date: Sun, 14 Jun 2015 08:00:34 +0200
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=MBfblyto1mvdSklQG2jycj5MmUA/MGI7uay7fglIb/A=; b=qSleLObMJMU1jj7630FxuJBOSYi8AI3+7mINC3zIhJM0ya2mi3EkvTllPhtdqNR4eX w0jS9y7uYzNozZq3MxAVrDW8msrqlngqzoKHjoCacQp4a8rF539+lCi1HhjcYb3aSZxC l8wpndk/XWMBMrJSDV3LDHIFuDH6MVZk1tK51spLvoH0xmooQdVCKPHgQ0mEZFlj97Ku jlKEaAPqd1zI9PRyMmCI1it8w0so086P2kKnWKX6J5z+SvrfOf6pMWDlcEfc/a8jag07 AxxDjPjnRf6PICtKDgbicfiKf+HjjnD5zxnWv/GCQpg6570spigE2hMwAwoPfWQlYiBR To7Q==
- In-reply-to: <150613165827.ZM29680@torch.brasslantern.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: <CAHYJk3Q3QVWpAzR2VGVBuJhLTW7xtmRBRC6R2CPHYq79O5WT8A@mail.gmail.com> <150613165827.ZM29680@torch.brasslantern.com>
On Sun, Jun 14, 2015 at 1:58 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jun 14, 1:05am, Mikael Magnusson wrote:
> }
> } Is this an intended change?
>
> Hm. Sort of. It's a side-effect of implementing POSIX_ARGZERO.
>
> With POSIX_ARGZERO set, $0 must always contain the name used to invoke
> the shell. If POSIX_ARGZERO changes from set to not set, $0 has to be
> restored as specified by the (on or off) setting of FUNCTION_ARGZERO.
>
> Consequently the value of $0 became fixed for both cases; assignments
> to it are no-ops.
>
> However, you can still change the value of $0 by hiding the special:
>
> torch% () { local -h 0=hello; echo $0 }
> hello
Ah, I see. I was only using it in a single helper function out of
laziness, precisely because it let me leave out a local statement. :)
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author