Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Can't overwrite $0 in functions anymore
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author