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

Re: alias not found



On Oct 29,  1:32pm, Ray Andrews wrote:
}
}     $ . ./navtools; type naliases; naliases
}     naliases is an alias for n_aliases
}     zsh: command not found: naliases

The entire line ". ./navtools; type naliases; naliases" has already
been parsed into bytecode before any of it is executed.  So when
navtools creates the alias, it's too late -- naliases has already
been consumed and is not subject to alias replacement until another
subsqeuent chunk of input is presented to the parser (effectively,
not until after the next PS1 prompt is printed).

This is one reason aliases are a bad idea in general.  It would be
much better if navtools used e.g.

    function naliases { n_aliases "$@" }



Messages sorted by: Reverse Date, Date, Thread, Author