[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 12:05:53 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.17) 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" ' "${vals[@]}" ; echo
>>
>> and get the double-quoting you want.
>
> Fails horribly if the array elements contain double quotes of their own.
Read what I wrote:
"For straight debugging output, it's probably ok."
Presumably Steven understands something about the expected values and will
be able to cope with a stray double-quote.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/