Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: make aliases work inside the function? (using a preprocessor?)
- X-seq: zsh-users 21513
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Marc Chantreux <khatar@xxxxxxxxx>
- Subject: Re: make aliases work inside the function? (using a preprocessor?)
- Date: Wed, 04 May 2016 16:55:41 +0200
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1462373742; bh=KdSgCpnBg85nfKA4w7tZjUqx4AKMev5Em01cRsqJu7A=; h=cc:In-reply-to:From:References:To:Subject:Date:From:Subject; b=f+2MTpiLHvbrpp2+VSV2oCwmBROYJkyehexZWpxJFozvFxIp8Dmn/3SKLEpJlHjZnfxH7HJsI1CbFwP6Q6UFHZZQKbVhfknWsAy/Mn7lXuvjrufjHkQ1fa2IGiAg6Wz06v7VwOSwqZIq5YaZnexdpFvj0BCrNgQmZ9QTh1B3acoCu79D5V9pqhkJ+jF20Ow+H7W1IwXS7T7xoTSp3Xc8Xtlqg5yoDF3uOw7EsxRm/8Nck3/ISCWEAkjvQp1m1FHIHYDbOssTB5hKcycPuS3uHSLwIRgnsNrz0sylEQevvCoA+fyLW+20kTXCSxnYECyJHw7l/Ot1Ea4Bbvq6BbZVew==
- In-reply-to: <20160504134632.GA5729@aurora-borealis.phear.org>
- 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: <20160504134632.GA5729@aurora-borealis.phear.org>
Marc Chantreux wrote:
>
> I have
>
> % which €
> € () {
> setopt localoptions unset nowarncreateglobal
> "$@" }
> % which l
> l: aliased to print -l
> % € l error
> €: command not found: l
You could also try using:
alias €='€ '
This doesn't enable alias expansion inside the function if that is
exactly what you need. But it does work for the example above: the
trailing space in the alias indicates that the next word is treated as
being in command position for alias expansion so l will be expanded
already outside the function.
It's quite common to use this with precommands, for example:
for com in command builtin time nice - nocorrect exec rusage noglob eval nohup;
alias -- $com="$com "
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author