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}"'
~

Reply via email to