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

2020-07-18 Thread Chet Ramey
On 7/18/20 1:38 AM, Oğuz wrote:
> See:
> 
> $ set +k -o posix
> $ echo foo=~:~
> foo=~:/home/oguz
> 
> If I'm not misreading the standard `foo=~:~' should be printed
> verbatim, all shells I have except bash does so.

Thanks for the report. This one has been around since bash-3.1.

Chet

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



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

2020-07-18 Thread Oğuz
19 Temmuz 2020 Pazar tarihinde Chet Ramey  yazdı:

> On 7/18/20 1:38 AM, Oğuz wrote:
> > See:
> >
> > $ set +k -o posix
> > $ echo foo=~:~
> > foo=~:/home/oguz
> >
> > If I'm not misreading the standard `foo=~:~' should be printed
> > verbatim, all shells I have except bash does so.
>
> Thanks for the report. This one has been around since bash-3.1.
>
>
I guess it was such a trivial bug that no one cared to report. 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. I don't see any reason why it
shouldn't assign `/home/oguz:/home/otheruser' instead. Yes, no one does
that yet and there's not much real world use case for this feature, but
this way it'd be more consistent with variable assignments, right?


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


-- 
Oğuz