Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: aliases expanding aliases: a bug?
- X-seq: zsh-users 14624
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Jay Berkenbilt <ejb@xxxxxx>
- Subject: Re: aliases expanding aliases: a bug?
- Date: Tue, 1 Dec 2009 21:13:17 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=4KHBQiCmHLGFpgPUVbmYJnXJid6z1yGRdRrgBy3qO5g=; b=VYAxGEviKCAC07KRD9tEfEGDDeC+h2r6WwsKXO9q8Tk2yRLMUH0RXLXu2fuLdA7jXI LSCuCZ3poKbWrp2eUVVYwPcsJlP/OoSkMnLnGLpkNMz5kWOef3uzpdEv2KT3n+Qsi1sI BrPXAGOjn4HpVTGOYDs1am42Z58W5ZZGt3x7U=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ARhmnxhpsYFA0/zpU8xD5HJFAHPtm/7N+4S/3TwsSs3RO/3v0jShGrLBwjUZFWxLnu YDng8hQvL+n9OJtfg8d+5XGjoG+9BBiSI6E2oHUMQBAONRnaWpeOgTP0difMYVBTxDs4 OWXLqn4Z4rbk1SLDI34JK94xmfhQ5O9+LJNig=
- In-reply-to: <20091201150051.0942597181.qww314159@xxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20091201150051.0942597181.qww314159@xxxxxxxxxxxxxxxxxx>
2009/12/1 Jay Berkenbilt <ejb@xxxxxx>:
> I just downloaded zsh 4.3.10, and I am able to reproduce this problem
> with that version. It appears that if an alias ends with a space,
> arguments that themselves happen to be aliases are expanded, at least in
> some cases.
[snip]
> I can't imagine that this is desirable or intended behavior. It's also
> hard for me to see why one would have to have a trailing space in an
> alias that was expected to take arguments, but regardless, it still
> seems like a possible bug.
>
> Comments?
This is documented behaviour, and very useful in some cases.
ALIASING
Every token in the shell input is checked to see if there is an
alias defined
for it. If so, it is replaced by the text of the alias if it
is in command
position (if it could be the first word of a simple command),
or if the alias
is global. If the text ends with a space, the next word in
the shell input
is treated as though it were in command position for purposes
of alias expan-
sion.
consider an alias like
alias foo='xterm -e '
alias bar='ls -l /long\ and\ boring\ path'
which lets you say foo bar
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author