From: Zefram <zefram@fysh.org>
To: Carlos Carvalho <carlos@fisica.ufpr.br>
Cc: zsh-users@sunsite.dk
Subject: Re: aliases not getting expanded inside functions?
Date: Fri, 3 Jan 2003 18:54:07 +0000 [thread overview]
Message-ID: <20030103185407.GA11836@fysh.org> (raw)
In-Reply-To: <15893.53780.524763.695176@fisica.ufpr.br>
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
next prev parent reply other threads:[~2003-01-03 18:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-03 15:31 Carlos Carvalho
2003-01-03 15:39 ` Zefram
2003-01-03 15:45 ` Phil Pennock
2003-01-03 17:24 ` Carlos Carvalho
2003-01-03 17:44 ` Phil Pennock
2003-01-03 18:10 ` Carlos Carvalho
2003-01-03 18:54 ` Zefram [this message]
2003-01-06 8:29 ` Carlos Carvalho
2003-01-06 12:54 ` Bart Schaefer
2003-01-11 3:19 ` Carlos Carvalho
2003-01-11 18:40 ` Bart Schaefer
2003-01-13 17:59 ` Carlos Carvalho
2003-01-13 18:48 ` Bart Schaefer
2003-01-13 21:40 ` Carlos Carvalho
2003-01-14 5:10 ` Bart Schaefer
2003-01-14 11:44 ` Roman Neuhauser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030103185407.GA11836@fysh.org \
--to=zefram@fysh.org \
--cc=carlos@fisica.ufpr.br \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).