[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: unalias works weirdly inside an if-then block
From: |
Gabor Burjan |
Subject: |
Re: unalias works weirdly inside an if-then block |
Date: |
Fri, 12 May 2017 15:26:21 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Fri, May 12, 2017 at 08:11:35AM -0500, Eduardo Bustamante wrote:
> On Fri, May 12, 2017 at 7:33 AM, Gabor Burjan <buga@buvoshetes.hu> wrote:
> [...]
> > Description:
> > unalias works weirdly inside an if-then block
>
> It's not just an if-then block. It's any kind of block:
> [...]
>
> (the key part here is that aliases are expanded when a command is
> read, not when it's executed. Bash needs to parse the whole block, at
> which point the alias is expanded. The unalias is not executed but
> until after).
In this case it's not a bug, but the documented behaviour.
Thanks for the explanation.
BR,
Gabor