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

Re: path PATH



On Sat, Jan 21, 2023 at 9:51 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2023-01-21 11:09, Roman Perepelitsa wrote:
> > Is the number 42 "in fact" 8#52?
> Yes, it most certainly is -- in base 8, which is explicit.

It's a different representation for the same thing, isn't it? Neither
is the real thing or the actual value.

The same goes for "A", "\x41" and "\101". These are different
representations for the same object, with none being the object
itself. Now, when `typeset -p` prints the value of a parameter, it has
to choose some representations and there is no obvious choice, for no
representation is "the true one". In this case it so happens that the
representation for a tied parameter chosen by `typeset -p` is the
array's elements, while you would prefer to see a different
representation -- that of the scalar. Whenever you simply need to know
what a parameter is, any representation will suffice and so you use
`typeset -p`. When you need to see a specific representation, you
should not use `typeset -p` and instead arrange for your preferred
representation to be produced explicitly. In this case that could be:

    print -r -- "PATH=${(qqq)PATH}"

Or maybe you'll prefer a different quoting scheme. In any case, if you
want a specific representation, ask for that explicitly.

Roman.




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