Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: path PATH



On Sun, Jan 22, 2023 at 12:03 PM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> % describe-params 0
> scalar-special 0=describe-params
>
> Would it be better to use POSIX_ARGZERO to reveal the name of the
> shell itself?  There's no way from inside a function to grab $0 from
> the caller unless the caller itself asserts NO_FUNCTION_ARGZERO.

Similar silliness that it may not be possible to fix, so maybe the
above isn't worth considering:

% describe-params '(#i)arg*' \?
integer-readonly-special '!'=0
integer-readonly-special '#'=10
array-readonly-special '*'=( '*' - '?' @ _ '$' 0 ARGC argv )
scalar-readonly-special -=569XZfims
integer-readonly-special '?'=1
array-readonly-special @=( @ _ '$' 0 ARGC argv )
scalar-special _=_
integer-readonly-special '$'=394907
scalar-special 0=describe-params
integer-readonly-special ARGC=2
array-special argv=( argv )

In case not obvious what I mean, $* and $@ and $argv should all have
the same elements, and $# and $ARGC should be equal to one another and
to the number of elements in the first three, but this can't be
preserved while using ARGC and shift to walk the names.  Also, $? is
nonzero because of the "if" test, and $_ is _ because that's the last
word of the command that prints the value of $_.  It's like trying to
examine quantum superposition.




Messages sorted by: Reverse Date, Date, Thread, Author