Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: aliases not getting expanded inside functions?
- X-seq: zsh-users 5647
- From: Carlos Carvalho <carlos@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: aliases not getting expanded inside functions?
- Date: Fri, 3 Jan 2003 16:10:28 -0200
- In-reply-to: <20030103184455.A5692@xxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <15893.44217.393956.262362@xxxxxxxxxxxxxx> <20030103164552.A28966@xxxxxxxxxxx> <15893.50996.646711.184945@xxxxxxxxxxxxxx> <20030103184455.A5692@xxxxxxxxxxx>
Phil Pennock (Phil.Pennock@xxxxxxxxxxx) wrote on 3 January 2003 18:44:
>print is merely what was used for showing the results. The variable
>substitution does not rely upon print.
I agree, I just used print as an example of reading the value, not
setting it.
>% set -A array alpha beta gamma delta epsilon zeta
>% guess_what='array[3]'
>% echo ${(P)guess_what}
>gamma
>% guess_what='array[4]'
>% echo ${(P)guess_what}
>delta
It doesn't work if you try to do guess_what=foobar, meaning
array[4]=foobar.
>% guess_what='array[1]'
>% for i in $(perl -le "print foreach split //, '${(P)guess_what}'") ; echo $i
>a
>l
>p
>h
>a
>%
Nice :-) I should have learned perl long since. In fact probably the
script I'm doing should be written in perl...
>I think that you're confusing "print -P", which recognises the same
>escape sequences as are used in prompt substitution, with the parameter
>expansion flag 'P', which is described in zshexpn(1).
The manual says "Recognize the same escape sequences as the print
builtin in string arguments to subsequent flags." So there should be a
relation.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author