[Top][All Lists]

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

Re: Inconsistent quote and escape handling in substitution part of param

From: John Kearney
Subject: Re: Inconsistent quote and escape handling in substitution part of parameter expansions.
Date: Wed, 29 Feb 2012 23:41:04 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0) Gecko/20120129 Thunderbird/10.0

It isn't just the quote removal that is confusing.

The escape character is also not removed and has its special meaning.

and this also confuses me
take the following 2 cases
echo ${aaaaa:-$'\''}
echo "${aaaaa:-$'\''}"
bash: bad substitution: no closing `}' in "${aaaaa:-'}"

and take the following 3 cases
echo "${aaaaa:-$(echo $'\'')}"
bash: command substitution: line 38: unexpected EOF while looking for
matching `''
bash: command substitution: line 39: syntax error: unexpected end of file

echo ${aaaaa:-$(echo $'\'')}
echo "${aaaaa:-$(echo \')}"

This can not be logical behavior.

On 02/29/2012 11:26 PM, Chet Ramey wrote:
> On 2/28/12 10:52 AM, John Kearney wrote:
>> Actually this is something that still really confuses me as
>> well.
> The key is that bash doesn't do quote removal on the `string' part
> of the "${param/pat/string}" expansion.  The double quotes are key;
> quote removal happens when the expansion is unquoted.
> Double quotes are supposed to inhibit quote removal, but bash's
> hybrid behavior of allowing quotes to escape characters but not
> removing them is biting us here.

reply via email to

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