[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: nullglob option breaks complex parameter expansion/deletion
From: |
Paul Jarc |
Subject: |
Re: nullglob option breaks complex parameter expansion/deletion |
Date: |
Tue, 05 Jul 2005 17:49:21 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) |
michael@mail.endbracket.net wrote:
> 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.
How exactly are you setting your prompt?
> $ connectioninfo='${HOST%%.*} ${USER}'
> $ echo $connectioninfo
This doesn't demonstrate any misbehavior in parameter expansion,
because ${HOST%%.*} does not undergo parameter expansion at all - in
the first line, because it is quoted, and in the second line, because
it is the result of parameter expansion. Try this instead:
$ echo ${HOST%%.*} ${USER}
This way, the HOST and USER parameters are expanded. On my system, it
gives the same output regardless of whether $HOST contains a dot or
whether any existing files match.
paul
Re: nullglob option breaks complex parameter expansion/deletion,
Paul Jarc <=