Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: path PATH
On 2023-01-20 22:11, Lawrence Velázquez wrote:
... so it is unique.
No, that just means that PATH is the only global scalar that has
been tied and exported. If you tie and export additional ones
they'll show up too.
But if it is the only one then it is unique. I didn't suggest that the
same situation might not be applied to another parameter, only that it
has not been. It just served as a possible clue as to why no variation
of 'typeset' will show you:
3 /aWorking/Zsh/Source/Wk 0 $ echo $PATH
.:/aWorking/Zsh/System:/aWorking/Bin:/usr/local/bin:/usr/sbin:/usr/bin
No, "typeset -T" ties an array to a scalar, which is synthesized
by joining the array's values with a separator character.
Now that you mention it, $PATH is a scalar ... hasta be because there's no spaces. But all the others display as arrays, so that's where I went wrong there. But 'PATH path' always displays as an array too. It still seems to be an anomaly. So then if we had other tied scalars they too would only display as arrays? Anyway, perhaps this just isn't worth worrying about, $PATH is a special case (I think) because as you say it's 'synthesized' via the joining of members with the colon vs. the space.
I dislike exceptions and special cases but perhaps this one is unavoidable. (Obviously the way $PATH works is by now fundamental, but I can't help wondering why a space separated array wouldn't work, like $path. IOW, given $path, why do we need $PATH at all?) Nevermind, I'm inclined to fret about things like this, it's not important I'd just like typeset to show me $PATH as it really is not pretend that's it's identical to $path when it isn't. Accuracy matters no? :
$ set | grep -i "^path"
PATH=.:/aWorking/Zsh/System:/aWorking/Bin:/usr/local/bin:/usr/sbin:/usr/bin
path=( . /aWorking/Zsh/System /aWorking/Bin /usr/local/bin /usr/sbin /usr/bin )
... In fact I'm trying to write a function that will show me *both* the type of all variables (typeset) *and* their accurate values (set). I've got it nailed down except for $PATH and the one exception bothers me. But life is one big exception.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author