bug-bash
[Top][All Lists]
Advanced

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

Re: Assignment-like word shouldn't be subjected to tilde expansion in PO


From: Chet Ramey
Subject: Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode
Date: Sun, 19 Jul 2020 15:21:07 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

On 7/19/20 1:47 AM, Oğuz wrote:
> By the way,
> wouldn't it be better if the same tilde expansion rules as with assignment
> statements was applied to parameter expansions that assign default values?
> Like,
> 
>     unset foo
>     echo ${foo=~:~otheruser}
> 
> assigns `/home/oguz:~otheruser' to `foo' regardless of whether `otheruser'
> is a valid login name for an existing user. 

Maybe, but Posix says this isn't a variable assignment context, as POSIX
defines variable assignments, and technically  the shell shouldn't perform
tilde expansions after `=' or `:' at all. You could argue that bash has a
bug here in that it expands the tilde after the `='.


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



reply via email to

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