help / color / mirror / code / Atom feed
* unexpected clearing of parameter flags with ::=
@ 2022-05-02  7:46 Mikael Magnusson
  0 siblings, 0 replies; only message in thread
From: Mikael Magnusson @ 2022-05-02  7:46 UTC (permalink / raw)
  To: zsh-workers

% typeset -Z3 i
% echo ${i=5}
% echo ${i:=15}
% echo ${i::=15}

The manpage says
  In the first form, if name is unset then set it to word; in the second
  form, if name is unset or null then set it to word; and in  the  third
  form,  unconditionally  set  name to word.  In all forms, the value of
  the parameter is then substituted.

which to me doesn't imply that the parameter is reset first,
especially since it isn't reset for the first form. I'm a little
confused as to why this doesn't assign the value either:

% unset i
% typeset -Z3 i
% echo ${i:=25}

but this does set it:
% unset i
% typeset i
% echo ${i:=25}

I thought maybe -Z3 causes the implicit value to be 000 but it is
printed as empty, so shouldn't it fulfil the "unset or null" condition
despite the -Z flag being active?

Mikael Magnusson

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-02  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02  7:46 unexpected clearing of parameter flags with ::= Mikael Magnusson

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).