If I set $fred: % fred="a [ a * a ? a \ a" If I expand fred while still on the command line: % echo "$fred" Then all the shell space/glob characters are escaped: % echo a\ \[\ a\ \*\ a\ \?\ a\ \\\ a How can I get this quoting/escaping behavior within a zsh function? 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? The best I've been able to come up with is: escaped="$fred" escaped="${escaped// /\\ }" escaped="${escaped//\[/\\[}" escaped="${escaped//\*/\\*}" ... I know there has to be a better way. Thanks, Steve