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

aliases not getting expanded inside functions?



Hi users,

First, thanks Bart for the info on the C preprocessor bug.

Now I'm trying to do something like

% alias -g foo='bar'
% escr() {print $foo}

I'd expect that since the alias is global, comes before the definition
of the function, and aliases are expanded when a function is read,
that the function would be in effect {print $bar}, but it isn't:

% which escr
escr () {
        print $foo
}

The "problem" is with the $, because if I write {print foo} instead of
{print $foo} in the definition the function appears as {print bar}, as
I expected. Is this correct? If so, is there a way to achieve this
substitution? This is in a script, not interactive.

Thanks in advance.



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