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

Re: there should be a way to echo with quotes or escaping



Dave Yost <Dave@xxxxxxxx> writes:

> Z% echo "abc def"
> abc def
> Z% echoquoted "abc def"
> 'abc def'
> Z% echoescaped "abc def"
> abc\ def
> Z%
> 
> or some such
> 
> If there is such a feature, I didn't see it mentioned under the echo
> command in the man page.

% a="foo' bar"
% echo ${(q)a}
foo\'\ bar
% echo ${(qq)a}
'foo'' bar'
% echo ${(qqq)a}
"foo' bar"

Note that I have rc_quotes set, otherwise:

% echo ${(qq)a}
'foo'\'' bar'

Phil.



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