[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: |
Greg Wooledge |
Subject: |
Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode |
Date: |
Tue, 21 Jul 2020 08:30:05 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Tue, Jul 21, 2020 at 03:14:59PM +0300, M. Nejat AYDIN wrote:
> On 7/21/20 2:48 PM, Greg Wooledge wrote:
> > On Tue, Jul 21, 2020 at 10:55:06AM +0300, M. Nejat AYDIN wrote:
> > > Also, shouldn't the tilde be expanded following
> > > $ echo ~:
> > > ? The colon terminates tilde-prefix in an assignment, but there is no
> > > assignment involved here.
> >
> > Works for me.
> >
> > unicorn:~$ echo ~:
> > /home/greg:
> >
> > Also in POSIX mode.
> >
>
> Oops, I've misstated.
> I think the tilde in
> $ echo ~:
> shouldn't have been expanded and should have been printed verbatim:
> ~:
Tilde Expansion, according to POSIX:
A "tilde-prefix" consists of an unquoted <tilde> character at the
beginning of a word, followed by all of the characters preceding the
first unquoted <slash> in the word, or all the characters in the word if
there is no <slash>. In an assignment (see XBD Variable Assignment),
multiple tilde-prefixes can be used: at the beginning of the word
(that is, following the <equals-sign> of the assignment), following
any unquoted <colon>, or both. A tilde-prefix in an assignment is
terminated by the first unquoted <colon> or <slash>. If none of the
characters in the tilde-prefix are quoted, the characters in the
tilde-prefix following the <tilde> are treated as a possible login
name from the user database. [...]
If the system does not recognize the login name, the results are
undefined.
For the record, ksh does the same as bash. Dash leaves the tilde
unexpanded. Obviously, I am assuming that one does not have a user
named : (as that would be basically impossible on any unix that uses
an /etc/passwd file in the traditional format).
I have no objection to bash's decision here. I actually find it less
surprising than dash's decision, although both are rational ones.
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, (continued)
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, Oğuz, 2020/07/19
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, Robert Elz, 2020/07/20
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, Chet Ramey, 2020/07/20
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, Robert Elz, 2020/07/30
- Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, Chet Ramey, 2020/07/31
Re: Assignment-like word shouldn't be subjected to tilde expansion in POSIX mode, M. Nejat AYDIN, 2020/07/21