From: Philippe Troin <phil@fifi.org>
To: Omen Wild <Omen.Wild@Dartmouth.EDU>
Cc: zsh users <zsh-users@sunsite.dk>
Subject: Re: Build a variable name from another variable?
Date: 23 Jan 2004 15:19:20 -0800 [thread overview]
Message-ID: <87oesugsnb.fsf@ceramic.fifi.org> (raw)
In-Reply-To: <20040123224220.GB3354@descolada.dartmouth.edu>
Omen Wild <Omen.Wild@Dartmouth.EDU> writes:
> I am not totally sure what it is called, but I want to build a variable
> name dynamically, from the contents of another variable. That is, I
> have:
>
> ----- Begin script -----
> barcontents="bar contents"
> baz="bar"
>
> echo $barcontents # <---- effect I want
> echo ${${baz}contents} # <---- how I want to get there
> ----- End script -----
% t="${baz}contents"
% echo ${${(P)t}}
bar contents
Works...
i could not manage to do it without an intermediate variable.
Phil.
next prev parent reply other threads:[~2004-01-23 23:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-23 22:42 Omen Wild
2004-01-23 23:19 ` Philippe Troin [this message]
2004-01-24 0:51 ` Omen Wild
2004-01-24 2:36 ` Bart Schaefer
2004-01-23 23:47 ` Cosmo
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=87oesugsnb.fsf@ceramic.fifi.org \
--to=phil@fifi.org \
--cc=Omen.Wild@Dartmouth.EDU \
--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).