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

Re: quote modifier for parameter expansion?



Sven Wischnowsky wrote:
> Hm. I'm sure I'm missing something again, but could anyone please tell 
> me what? The patch below (which probably shouldn't be used) just uses
> the quote()-function from hist.c to make the `q' modifier in parameter 
> expansion work. The result is almost always a funny looking string in
> single quotes, but that alone can't be the reason not to use this
> function.

Does exactly what I would expect it to.

% bar="hello'there"
% print -r $bar:q
'hello'\''there'

Maybe the point is simply it's got limited application, since unless
it's going into an eval the extra quotes aren't all that useful,
unlike in history substitution which happens before the quotes get
swallowed.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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