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

Re: path PATH

On Sat, Jan 21, 2023 at 5:21 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
> One could create other variables that show as 'export -T
> ...' but this is not actually done in the raw shell, so PATH is unique
> even if not 'special' as you use the word.

I'm not sure what you are trying to say here. PATH has a unique name,
yes, but it behaves like any other parameter. In particular, `typeset
-p` works on PATH the same way as on any other parameter. Perhaps you
want `typeset -p` to work differently for PATH? In other words, do you
want PATH to be special?

> However it is 'special' in that 'typeset -p PATH' does not show
> it's accurate value.

`typeset -p PATH` does show the precise and accurate value of PATH.
It's so precise and accurate that you can literally evaluate the
output to obtain exactly the same state of PATH in another shell.

The job of `typeset -p` is to tell you precisely and accurately what a
certain parameter is. The output of `typeset -p PATH` achieves that.
There is no hidden "real" value that it doesn't show. It shows every
bit of information related to PATH.

Consider this snippet:

    % typeset foo=$'1\n2'
    % print -r -- $foo
    % typeset -p foo
    typeset foo=$'1\n2'

Is `typeset -p` also not printing the "real" value of the parameter here?

I'll ask again: what do you think should be the output of `typeset -p PATH`?



I think you perceive some difference between PATH and FOO from my
previous email. There isn't any. There are some tools (commands and
builtins) whose *behavior* depends on PATH, but that doesn't imply
anything special about the parameter itself.

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