bug-bash
[Top][All Lists]
Advanced

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

Re: Tilde expansion during command search


From: lolilolicon
Subject: Re: Tilde expansion during command search
Date: Thu, 24 Jul 2014 14:34:13 +0800

On Wed, Jul 23, 2014 at 11:00 PM, lolilolicon <lolilolicon@gmail.com> wrote:
> On Wed, Jul 23, 2014 at 10:43 PM, Eric Blake <eblake@redhat.com> wrote:
>> But we are talking about the case where ~ IS quoted during
>> the assignment, and only bash then re-expands it during path lookup.
>
> That's my point. Let me try quoting this again,
>
>     Note that the tildes are expanded during the assignment to PATH, _not
>     when PATH is accessed during command search._
>
> in which I was trying to imply that, Bash *does* expand the tildes _when
> PATH is accessed during command search._

I'm sorry if it felt like I was taking that sentence out of context.
Well, I was; but I think it's fair to assume that whoever wrote that
sentence would agree that tilde expansion should not be performed when
PATH is accessed during command search. "If the tilde were escaped when
the PATH were assigned, should we give the tilde a second chance and
expand it when the PATH were accessed?" To which POSIX would probably
say, "Hell no. We're reluctant enough to allow tilde expansion in
assignments already!"

How reluctant? If you look at the spec[1], you will see things like:

    Tilde expansion generally occurs only at the beginning of words, but
    an exception based on _historical practice_ has been included:

and more directly

    Consideration was given to prohibiting this behaviour because any of
    the following are reasonable substitutes:

So, has anyone asked the POSIX people about this?

[1] http://pubs.opengroup.org/onlinepubs/7908799/xcu/chap2.html#tag_001_006_001



reply via email to

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