bug-bash
[Top][All Lists]
Advanced

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

Re: remove empty '' in ${var@Q} result?


From: Chet Ramey
Subject: Re: remove empty '' in ${var@Q} result?
Date: Mon, 30 Oct 2017 10:41:02 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 10/29/17 10:34 PM, Clark Wang wrote:
> See following example:
> 
> [STEP 100] # echo $BASH_VERSION
> 4.4.12(2)-release
> [STEP 101] # v=\'\'
> [STEP 102] # printf '%q\n' "$v"
> \'\'
> [STEP 103] # printf '%s\n' "${v@Q}"
> ''\'''\'''
> [STEP 104] #

This is an effect of using single quotes in the @Q operator. If you want
to single-quote a string containing single quotes, this is how you do it.

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



reply via email to

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