Bash Version: 3.2
Patch Level: 0
Release Status: release
Description:
I suggest that tilde expansion should be done for tokens with
"=~" even when they start with "-".
The specific reason is that I expected
./configure --prefix=~/something
to work, but it doesn't, since the tilde isn't expanded.
There are other cases as well where the value of a long option
is a filename and it might be convenient to use ~, like
sort foo --output=~/bar
Repeat-By:
echo foo=~root => foo=/root
echo --foo=~root => --foo=~root
In the second one there is no expansion.
> Repeat-By:
> echo foo=~root => foo=/root
> echo --foo=~root => --foo=~root
>
> In the second one there is no expansion.
From my understanding of the manpage and the SUS the first one is
"wrong", it should not be expanded. I don't say it's useless, I just say
"from my understanding of the manpage and SUS".
J.
You're correct that Posix doesn't say either form should be expanded.
The first is a bash extension (and only bash -- it isn't done when bash
is running in posix mode).
Bash identifies words that satisfy the syntactic requirements of assignment
statements while parsing, and, as an extension, performs Posix-style tilde
expansion on them during word expansion. Assignment statements that are
arguments to `assignment builtins' like declare, export, readonly and the
like are treated exactly like assignment statements preceding command
words; other assignment statements undergo tilde expansion only.
And, before you ask, the second example is not recognized as an assignment
word, since the characters preceding the `=' do not constitute a valid
shell identifier.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU ch...@case.edu http://cnswww.cns.cwru.edu/~chet/
According to Chet Ramey on 12/8/2007 9:18 PM:
> You're correct that Posix doesn't say either form should be expanded.
> The first is a bash extension (and only bash -- it isn't done when bash
> is running in posix mode).
Speaking of tilde expansion and bash, are you aware that a POSIX
interpretation was just issued for review that states that the result of
tilde expansion should behave as though it were quoted, and not undergo
further pathname expansion or field splitting? The interpretation
(Austin-202) is still undergoing review, so it requires a login to read:
https://www.opengroup.org/austin/interps/protected/uploads/20/15352/AI-202.txt
But anyone can read the original report that spawned the interpretation
http://www.opengroup.org/austin/aardvark/latest/xcubug2.txt (search for
number 169)
The reasoning behind this is that ~ already represents a single path name,
so it should not be further expanded. However, bash 3.2 does not obey
this rule (it avoids field splitting, but mistakenly performs pathname
expansion if $HOME contains glob characters).
- --
Don't work too hard, make some time for fun as well!
Eric Blake eb...@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHW3Fq84KuGfSFAYARAidCAJ4jxsm6ny2/7etKuvGW30DULfTD2wCfZM6A
SPHJtxUrt7wqjkfLYq9iVdc=
=DtLM
-----END PGP SIGNATURE-----
> Speaking of tilde expansion and bash, are you aware that a POSIX
> interpretation was just issued for review that states that the result of
> tilde expansion should behave as though it were quoted, and not undergo
> further pathname expansion or field splitting?
Yes, I'm an Austin Group member.
I've already made the appropriate change.