Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: alias bug on solaris machines
- X-seq: zsh-users 12337
- From: Peter Stephenson <pws@xxxxxxx>
- To: ZSH User List <zsh-users@xxxxxxxxxx>
- Subject: Re: alias bug on solaris machines
- Date: Thu, 20 Dec 2007 14:05:15 +0000
- In-reply-to: <20071220134602.GB19213@xxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20071220134602.GB19213@xxxxxxxxx>
Andy Spiegl wrote:
> I discovered a very strange behaviour on my solaris machine.
> Aliases are treated like global aliases in some cases:
>
> $ zsh -f
> % echo $ZSH_VERSION
> 4.3.2
> % alias
> run-help=man
> which-command=whence
> % GREPCOLOR=""
> % alias grep="grep $GREPCOLOR"
> % echo "foo man bar" >> /tmp/bla
> % grep run-help /tmp/bla
> foo man bar
That's actually expected behaviour. It's documented that aliases that
end with a space cause the following word to be expanded as an alias.
Since GREPCOLOR is empty, the alias for grep does end with a space.
You ought to do something like
[[ -n $GREPCOLOR ]] && alias grep="grep $GREPCOLOR"
or
alias grep="grep${GREPCOLOR:+ $GREPCOLOR}"
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author