Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: aliases not getting expanded inside functions?
- X-seq: zsh-users 5648
- From: Zefram <zefram@xxxxxxxx>
- To: Carlos Carvalho <carlos@xxxxxxxxxxxxxx>
- Subject: Re: aliases not getting expanded inside functions?
- Date: Fri, 3 Jan 2003 18:54:07 +0000
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <15893.53780.524763.695176@xxxxxxxxxxxxxx>
- 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> <15893.53780.524763.695176@xxxxxxxxxxxxxx>
Carlos Carvalho wrote:
>The manual says "Recognize the same escape sequences as the print
>builtin in string arguments to subsequent flags." So there should be a
>relation.
That's the "p" (*small* p) flag. Phil was demonstrating the "P"
(*capital* P) parameter expansion flag, which zshexpn(1) describes thus:
# P This forces the value of the parameter name to be
# interpreted as a further parameter name, whose
# value will be used where appropriate. If used with
# a nested parameter or command substitution, the
# result of that will be taken as a parameter name in
# the same way. For example, if you have `foo=bar'
# and `bar=baz', the strings ${(P)foo}, ${(P)${foo}},
# and ${(P)$(echo bar)} will be expanded to `baz'.
To use this kind of parameter alias for setting, you can do
% foo=bar bar=baz
% echo ${(P)foo}
baz
% : ${(P)foo::=xxx}
% echo ${(P)foo}
xxx
% echo $foo $bar
bar xxx
which also works where foo is an array reference such as "array[3]".
-zefram
Messages sorted by:
Reverse Date,
Date,
Thread,
Author