[Top][All Lists]

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

Re: Yet another quoting question

From: Chet Ramey
Subject: Re: Yet another quoting question
Date: Fri, 06 May 2011 14:23:13 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20110414 Thunderbird/3.1.10

On 5/6/11 12:00 PM, Greg Wooledge 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.

As they say, if you think that's horrible, your life must be sweet

Let's not let perfect be the enemy of good enough.  If coping with
unescaped double quotes is an issue, use

printf '"%s" ' "address@hidden//\"/\\\"}" ; echo

instead to get a little farther.  If you already have escaped double
quotes, then you don't need it.

If you can use this approach to get the problem solved, then use it.
If not, try something else -- another tool, if necessary.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

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