On Sun 02 Mar 2014 10:12:04 Andreas Schwab wrote: > Dave Yost <d...@yost.com> writes: > > I have an ugly function I wrote for zsh that does this: > > > > Sat 14:17:25 ip2 yost /Users/yost > > 1 634 Z% echo-quoted xyz \$foo 'a b c ' '\n' > > xyz '$foo' 'a b c ' '\n' > > Sat 14:17:53 ip2 yost /Users/yost > > 0 635 Z% > > > > It would be nice if there were an easy way to do this in bash. > > printf "%q" does that.
indeed -- also remember that you need "$@" and not $@ (as OP's first e-mail used). e.g.: set -- a 'b c d' 1 2 printf '%q ' "$@" -mike
signature.asc
Description: This is a digitally signed message part.