Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Bug#480889: zcompiling messes with alias-in-function expansion



Clint Adams wrote:
> I imagine that this is somehow related to
> 
> alias foo='echo bar'; foo

Right, it's the same problem.  Aliases are expanded early on, during
input, and so you can't use an alias within the same chunk of shell code
as where it's defined.  This isn't going to change; you need to find a
workaround.  The standard approach is to use functions in such chunks of
code.  Aliases tend to be regarded as largely an interactive feature.

This ought to be documented somewhere, if it isn't.

-- 
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