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

Re: Escaping shell characters in a string



On Tue,  9 Sep 2003 12:52:02 -0400, Steve Talley wrote:
[...]
> % fred="a [ a * a ? a \ a"
[...]
> That is, given a variable, how can I best escape all of the special
> shell characters within?  Is there a variable modifier I can use that
> automatically escapes all special characters?

I believe ${(q)fred} is what you want.

-- 
Michał Politowski -- mpol@xxxxxxxxxxxxxxxxxxx
Talking has been known to lead to communication if practised carelessly.



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