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    c...@case.edu    http://tiswww.cwru.edu/~chet/

Reply via email to