bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFE: a way to echo the arguments with quoting


From: Mike Frysinger
Subject: Re: RFE: a way to echo the arguments with quoting
Date: Sun, 09 Mar 2014 19:56:15 -0400
User-agent: KMail/4.12.3 (Linux/3.13.0; KDE/4.12.3; x86_64; ; )

On Sun 02 Mar 2014 10:12:04 Andreas Schwab wrote:
> Dave Yost <Dave@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

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]