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

Re: path PATH

On 2023-01-21 09:01, Roman Perepelitsa wrote:

3 /aWorking/Zsh/Source/Wk 1 $ set | grep  "^PATH"

3 /aWorking/Zsh/Source/Wk 1 $ typeset -p PATH
export -T PATH path=( . /aWorking/Zsh/System /aWorking/Bin
/usr/local/bin /usr/sbin /usr/bin )
Can you elaborate? Do you believe that these two commands should have
identical output?
Yes.  Both would seem to be displaying values.  And in every case except PATH, that is exactly what happens.

Does it bother you that in the following snippet the last two commands
also don't have identical output?

     % export -i8 BAR=42

     % typeset -p BAR
     export -i8 BAR=42

     % env | grep BAR

These are different commands and they have different output. Neither
shows the "true" or "real" value of the parameter. `typeset -p` shows
exactly and precisely what a zsh parameter is, while `env` shows the

That's a bit Byzantine isn't it?  If 'env' displays the base of the number whereas typeset displays the command by which the base was forced, no I don't think that's a genuine comparison.  It's nothing the same as PATH displaying with spaces when in fact it has colons.  In your example one clearly anticipates the other; it's actually the same information just formatted differently.


> The definition of a tied parameter is that one of the pair is a scalar string with an internal delimiter defaulting to a colon, and the other is an array of the delimited values.  There's nothing magic about PATH in this respect.

Ah!  So now we're barking up the same tree.  But ... all the other tied parameters look like merely the same array with two different names.  Have I made the wrong pattern?


Yes, I have:  set | grep FPATH  ... and what do I see but colons!

NUTS!  All the others, there's only one element so there's no chance for the colons to show up :(  they define as arrays, but there's actually just the one element so that's where I lost the scent.  I get it.  Many thanks.  So PATH is indeed unique but it isn't special :)

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