bug-bash
[Top][All Lists]
Advanced

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

Re: leading "--" changes whether `~' is expanded?


From: Daniel Gildea
Subject: Re: leading "--" changes whether `~' is expanded?
Date: Wed, 9 Jun 2004 14:32:22 -0400
User-agent: Mutt/1.4.1i

I was bitten by this recently - I assumed that when I typed
--prefix=~karl the tilde would be expanded because filename
completion was working, expanding the tilde.

I would suggest tilde expansion should happen on the command
line whenever it happens in readline completion, giving 
you a better feeling for what is going to happen when you
hit return.

Dan







> From: Chet Ramey
> Subject:     Re: leading "--" changes whether `~' is expanded?
> Date:      Wed, 16 May 2001 09:48:17 -0400
> 
> > This question arose on the Gnus development list, in debugging why
> > ./configure's invocation was not behaving as expected.
> > 
> > [1546] [08:51:55] cinnamon:~> echo $BASH_VERSION
> > 2.05.0(1)-release
> > [1546] [08:51:56] cinnamon:~> echo ./configure prefix=~karl
> > ./configure prefix=/home/karl
> > [1547] [08:52:03] cinnamon:~> echo ./configure --prefix=~karl
> > ./configure --prefix=~karl
> > 
> > The difference is only in whether the "--" is part of the last
> > argument.  It was further observed that 1.14 expands the `~'
> > regardless of the presence of "--".
> > 
> > Any reason why this is the case?  It doesn't seem (from reading the
> > bash 2.05 manual page) that the conception of a "word" in Tilde
> > Expansion should be affected by the dashes.
> 
> Bash does tilde expansion in words that appear to be variable
> assignments (POSIX.2, section 3.6.1).  POSIX says to do it only for
> assignment statements preceding a command, but bash does it for any
> word that looks like an assignment statement (unless bash is running
> in posix mode).  Since the leading `--' makes an invalid lhs for a
> variable assignment, --prefix=~xxx is not a candidate for tilde
> expansion.  However, `make DESTDIR=~/bin' would be tilde expanded,
> even though POSIX says not to.
> 
> Chet
> 




reply via email to

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