[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tilde expansion during command search
From: |
Dan Douglas |
Subject: |
Re: Tilde expansion during command search |
Date: |
Fri, 01 Aug 2014 08:53:46 -0500 |
User-agent: |
KMail/4.13.3 (Linux/3.16.0-rc7; KDE/4.13.3; x86_64; ; ) |
On Friday, August 01, 2014 06:20:28 AM Mike Frysinger wrote:
> On Wed 23 Jul 2014 08:51:19 Dan Douglas wrote:
> > On Wednesday, July 23, 2014 09:28:02 AM you wrote:
> > > On 7/23/14, 8:22 AM, Dan Douglas wrote:
> > > > Hi, from this discussion:
> > > >
> > > > https://github.com/koalaman/shellcheck/issues/195#issuecomment-49678200
> > > >
> > > > I can't find any reference that says substituting a literal tilde in
> > > > PATH
> > > > should occur during command search.
> > >
> > > Bash has always done this, even back to the pre-version 1 days, and I
> > > don't
> > > see any reason to change it now.
> >
> > The only concerns I can think of are inconsistency with programs that use
> > execvp(), or possibly double-expansion in the event of a user name or any
> > path containing ~.
>
> how so ? execvp doesn't do tilde expansion. only the shell does.
That's the problem. A program using execvp should be able to expect the same
result as that of the shell for a given PATH value. Because of this, it can't,
unless exec has the same implementation.
> and it does it once at assignment.
The example from my first post demonstrates that Bash substitutes a literal
tilde in PATH during the actual path search before executing a command, in
addition to during assignments and word expansions.
--
Dan Douglas
signature.asc
Description: This is a digitally signed message part.