[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: behaviour change between 4.2/4.3 with tilde
From: |
Greg Wooledge |
Subject: |
Re: behaviour change between 4.2/4.3 with tilde |
Date: |
Wed, 22 Oct 2014 08:01:58 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Oct 22, 2014 at 10:20:04AM +0200, Hanno Böck wrote:
> export a='x'; echo "${a/x/~}"
>
> On bash 4.3 this will result in the user's homedir path. On 4.2 this
> will result in a ~.
> If one wants to get a "~" char there seems no easy portable way to do
> so. Using escaping with \~ works in 4.3, but not in 4.2.
Here is a workaround:
imadev:~$ bash-4.2 -c 'a="x" t="~"; echo "${a/x/$t}"'
~
imadev:~$ bash-4.3 -c 'a="x" t="~"; echo "${a/x/$t}"'
~