Bash Version: 4.2 and 4.3

Description:

I find this change in quoting from 4.2 to 4.3 odd, where double-quoted
"~" used to be quoted (no expansion) and no longer works:

Bash version 4.2.25(1)-release:

    $ x=foo
    $ y="${x/foo/\~}"   # backslash is more than is needed
    $ echo "$y"
    \~
    $ y="${x/foo/~}"    # double quotes work
    $ echo "$y"
    ~
    $ y=${x/foo/\~}     # backslash also works
    $ echo "$y"
    ~
    $ y=${x/foo/~}      # expands (okay)
    $ echo "$y"                                                               
    /home/idallen

Bash 4.3 takes extra work to hide the tilde:

    $ x=foo
    $ y="${x/foo/\~}"    # need both double quotes *and* backslash !?
    $ echo "$y"
    ~
    $ y="${x/foo/~}"     # doesn't quote any more (worked in 4.2)
    $ echo "$y"
    /home/idallen
    $ y=${x/foo/\~}      # quotes same as 4.2
    $ echo "$y"
    ~
    $ y=${x/foo/~}       # expands same as 4.2
    $ echo "$y"                                                               
    /home/idallen
    
Is this an intentional change?

Reply via email to