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: 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

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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