bug-bash
[Top][All Lists]
Advanced

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

Re: Shell substitution with quotes in bash-4.1


From: Julien Thomas
Subject: Re: Shell substitution with quotes in bash-4.1
Date: Thu, 26 Feb 2015 14:24:23 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

jthomas@blackbird:~$ foo=aXb ; echo "$BASH_VERSION : ${foo/X/\'}"
4.2.53(1)-release : a\'b

jthomas@blackbird:~$ foo=aXb ; echo "$BASH_VERSION : ${foo/X/$'\x27'}"
bash: bad substitution: no closing `}' in "$BASH_VERSION : ${foo/X/'}"

jthomas@blackbird:~$ q=$'\x27'; foo=aXb ; echo "$BASH_VERSION : ${foo/X/$q}"
4.2.53(1)-release : a'b

Julien

On 02/26/2015 02:20 PM, Corentin Peuvrel wrote:
Hello,

I found a bug in bash-4.1 (CentOS 6) that was fixed (at least) in
bash-4.3 (Fedora 21).

$ foo=aXb ; echo "$BASH_VERSION : ${foo/X/\'}"
4.3.33(1)-release : a'b

$ foo=aXb ; echo "$BASH_VERSION : ${foo/X/\'}"
4.1.2(1)-release : a\'b

The shell substitution add the backslash before the quote, but it
shouldn't (and ${foo/X/'} fail because it wait for an ending quote).

I was wondering if it was possible to backport a fix in 4.1 ?


Thank you,



reply via email to

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