bug-bash
[Top][All Lists]
Advanced

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

Re: Tilde expansion differences between 4.3 and 4.2


From: Chet Ramey
Subject: Re: Tilde expansion differences between 4.3 and 4.2
Date: Wed, 14 Jan 2015 10:13:44 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.3.0

On 1/14/15 9:09 AM, Ondrej Oprala wrote:
> reproducer:
> cd ~
> mkdir MYDIR
> cd MYDIR
> echo "${PWD/#$HOME/~}"
> 
> Result of echo in 4.3:
> /home/<user>/MYDIR
> 
> Result of echo in 4.2:
> ~/MYDIR
> 
> Is tilde expansion in 4.3 supposed to happen? 

Yes.  It's a Posix change.

Look at http://austingroupbugs.net/view.php?id=221, which reads, in part:

"For the four varieties of parameter expansion that provide for
substring processing (see [xref to 2.6.2 Parameter Expansion]),
within the string of characters from an enclosed "${" to the
matching '}', the double-quotes within which the expansion occurs
shall have no effect on the handling of any special characters."

which basically means that the outer quotes don't mean the stuff inside
the braces is quoted.  This was part of a cleanup of the semantics of
quotes surrounding a parameter expansion and how those quotes affect
character handling inside the expansion.

Look at threads including

http://lists.gnu.org/archive/html/bug-bash/2014-10/msg00197.html
http://lists.gnu.org/archive/html/bug-bash/2014-03/msg00038.html
http://lists.gnu.org/archive/html/bug-bash/2014-04/msg00077.html

and go back from there.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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