[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nullglob option breaks complex parameter expansion/deletion
From: |
Chet Ramey |
Subject: |
Re: nullglob option breaks complex parameter expansion/deletion |
Date: |
Fri, 01 Jul 2005 14:11:17 -0400 |
User-agent: |
Mozilla Thunderbird 1.0.2 (Macintosh/20050317) |
michael@mail.endbracket.net wrote:
> Bash Version: 3.0
> Patch Level: 16
> Release Status: release
>
> Description:
> I had been using ${HOSTNAME%%.*} in my prompt to show the local
> host name portion of my full host name (e.g. localhost instead
> of localhost.localdomain). After enabling the nullglob shell
> option, this pattern is being replaced by a null string. I
> don't think this behavior is desireable.
Perhaps not desirable, but, in the example you supplied, functioning as
designed.
>
> I don't fully understand the wording of the relevant portion of
> the POSIX standard on this topic, but I would expect this
> pattern to always function as it does without nullglob set:
That part of the POSIX standard isn't relevant for two reasons. First,
POSIX doesn't standardize `nullglob'. Second, the expansion described
is not happening.
What happens in the example you show is that a word that looks like a
parameter expansion is part of the expanded value of $connectioninfo,
but that word is not being expanded as a parameter. It's subject to
the normal glob expansion that the unquoted results of any parameter
expansion would be, and, since it doesn't match any filenames, is
removed when `nullglob' is enabled.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
Live...Laugh...Love
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
Re: nullglob option breaks complex parameter expansion/deletion, Paul Jarc, 2005/07/05