Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug report: `setopt noaliases` not respected in `local` statement without assignment.
- X-seq: zsh-workers 45630
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Marlon Richert <marlon.richert@xxxxxxxxx>
- Subject: Re: Bug report: `setopt noaliases` not respected in `local` statement without assignment.
- Date: Thu, 26 Mar 2020 10:59:09 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- In-reply-to: <CAHLkEDu76YfBKX+47pT58VAMHd=Ep7JDq8K+3jYBYCAx+W5GKA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHLkEDu76YfBKX+47pT58VAMHd=Ep7JDq8K+3jYBYCAx+W5GKA@mail.gmail.com>
On Thu, Mar 26, 2020 at 10:55 AM Marlon Richert
<marlon.richert@xxxxxxxxx> wrote:
>
> Test case:
>
> alias -g tail="multitail -Cs --follow-all"
> f() {
> setopt localoptions no_aliases
> local tail
> tail=1
> echo $tail
> }
Alias expansion happens when functions get parsed. If you don't want
`tail` to be alias-expanded within function `f`, you need to add
`setopt no_aliases` before the function of `f`.
> g() {
> setopt localoptions no_aliases
> local tail=1
> echo $tail
> }
`tail` within `local tail=1` is not subject to global alias expansion.
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author