[Top][All Lists]

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

Re: Yet another quoting question

From: DJ Mills
Subject: Re: Yet another quoting question
Date: Fri, 6 May 2011 12:07:52 -0400

On Fri, May 6, 2011 at 12:00 PM, Greg Wooledge <address@hidden> wrote:

> On Fri, May 06, 2011 at 11:50:34AM -0400, Chet Ramey wrote:
> > Eric suggested %q, and that works to a
> > certain degree, but you can also use
> >
> > printf '"%s" ' "address@hidden" ; echo
> >
> > and get the double-quoting you want.
> Fails horribly if the array elements contain double quotes of their own.
> Realistically, I do NOT advise even attempting this.  Do not try to write
> general functions that operate on arrays, passed by name.  Bash truly
> does not have the tool set to cope with this.  I can't stress this
> strongly enough.
The only possible way I can think of to do this safely in bash is to do
something like:

eval "printf '%s\0' \"address@hidden""

and then loop over the NUL-delimited output.

reply via email to

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