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

Re: aliases not getting expanded inside functions?



Phil Pennock (Phil.Pennock@xxxxxxxxxxx) wrote on 3 January 2003 16:45:
 >% bar='Fred Bloggs'
 >% foo='bar'
 >% function escr { print ${(P)foo} }
 >% escr
 >Fred Bloggs
 >
 >Is the above sufficient?

Unfortunately no, because I don't need it only for printing, but for
referencing as well. I have an array and I'd like to access the
elements by more meaningful names, so I tried to do

% alias -g guess_what='array[1]', etc.

Your suggestion doesn't work however when an assignment has to be made
to guess_what.

 >You might wish to read zshexpn(1), since there are many other weird and
 >wonderful ways in which zsh can pervert your data on demand.

I did but didn't see this possibility. In fact I still don't see...
What's the relation between recognizing the same escape sequences as
print and making a substitution? I'd be grateful for an explanation.



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