bug-bash
[Top][All Lists]
Advanced

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

Re: [ast-users] [ksh93] Should ~$user be tilde expanded?


From: Chet Ramey
Subject: Re: [ast-users] [ksh93] Should ~$user be tilde expanded?
Date: Thu, 25 Oct 2012 11:25:12 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

On 10/25/12 9:43 AM, David Korn wrote:
> cc: ast-users@research.att.com
> Subject: Re: [ast-users]  [ksh93] Should ~$user be tilde expanded?
> --------
> 
> 
>> I think bash behavior is correct according to
>> http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_
>> 06which
>> says tilde expansion should be done before parameter expansion.
>>
> 
> Where do you see that?  In section 2.6, it says
> 
> "Tilde expansion (see Tilde Expansion), parameter expansion (see Parameter
> Expansion), command substitution (see Command Substitution), and arithmetic
> expansion (see Arithmetic Expansion) shall be performed, beginning to end.
> See item 5 in Token Recognition.
> 
> which implies that these should be simultaneously from beginning to end.

But ksh isn't doing that.  It's taking the $u and saying `this tilde prefix
is a potential login name' and then applying expansions to that potential
login name.  You have to apply some ordering here, and ksh chooses a
different one than bash.  The standard doesn't make it explicit about what,
if any, expansions are performed on the login name, so both behaviors may
in fact be conformant.

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



reply via email to

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