Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: path PATH
On Mon, Jan 23, 2023 at 2:37 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> Me to sign off on Bart's code? Ha-ha :) I started using zsh in 2019
> while Bart has been a contributor since the previous century. When
> Bart and I disagree, it would be wise to go with his opinion by
> default.
On the other hand, that means there's a lot of stuff I've forgotten
that's fresh in your memory, and things I might take for granted that
you dig into.
> By the way, one thing bothers me about tied parameters. Is there
> really no way (other than parsing the output of `typeset -p`) to
> retrieve the name of the tied counterpart?
% typeset +m path
array tied PATH path
This DOES represent something that you can't get without "typeset",
and it's not exceptionally well documented:
Except when assignments are made with NAME=VALUE, using +m
forces the matching parameters and their attributes to be
printed, even inside a function. Note that -m is ignored if
no patterns are given, so 'typeset -m' displays attributes but
'typeset -a +m' does not. Ordinary scalar string parameters
have no attributes, so for those +m prints only the names.
> Now that I think of it, there are a few more parameter properties that
> aren't exposed through anything other than `typeset -p`.
% typeset -i8 -R10 foo
% typeset +m foo
integer 8 right justified 10 foo
> % typeset -F2 foo
> % typeset -p foo
> typeset -F foo=0.00
>
> Note that the output is missing "2". Is this intended?
Almost certainly not.
% typeset +m foo
float foo
Messages sorted by:
Reverse Date,
Date,
Thread,
Author