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

Re: Is this a bug? Why not?

On 2010-03-31 at 08:11 -0700, Bart Schaefer wrote:
> Incidentally, this came up because of a discussion on the POSIX standards
> mailing list (austin-group) in which David Korn just asserted that he'd
> like to add the syntax ${"var"} which means to expand the value of var
> as if it's quoted (what zsh's normal mode does all the time).
> This differs from "${var}" because you can write ${"var"-*} and get the
> value of $var quoted but the glob pattern unquoted.  Apparently the old
> Bourne shell allows the abominable "${var"-*}  (note quote placement
> overlapping with brace placement) to accomplish this.
> I was hoping to be able to say "Oh, zsh already has syntax XYZ for that"
> but in fact we don't -- zsh either always, or never, does it, depending
> on the globsubst option; there's no way to flip globsubst on the fly.

No *neat* syntax.

% ls
lib         viewvc.conf
% print -l ${~~foo-${(~):-*}}
% foo='???'
$ print -l ${~~foo-${(~):-*}}
% print -l $foo
% unsetopt glob_subst
% print -l $foo      


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