bug-bash
[Top][All Lists]
Advanced

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

Re: pattern substitution expands "~" even in quoted variables


From: Mike Frysinger
Subject: Re: pattern substitution expands "~" even in quoted variables
Date: Sun, 09 Mar 2014 03:16:56 -0400
User-agent: KMail/4.12.3 (Linux/3.13.0; KDE/4.12.3; x86_64; ; )

On Fri 07 Mar 2014 16:15:05 Eduardo A. Bustamante López wrote:
> dualbus@debian:~$ for shell in /bin/bash ~/local/bin/bash; do "$shell" -c
> 'p=foo_bar; echo "${p/_/\~} $BASH_VERSION"'; done
> foo\~bar 4.2.37(1)-release
> foo~bar 4.3.0(2)-release

you can get same behavior in <=bash-4.2 and >=bash-4.3 by using single quotes:
        P="foo_bar"
        MY_P=${P/_/'~'}
        echo "${MY_P}"
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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