From: Dan Nelson <dnelson@emsphone.com>
To: Steve Talley <stephen.talley@sun.com>
Cc: zsh-users@sunsite.auc.dk
Subject: Re: Anonymous array indexing
Date: Tue, 12 Dec 2000 22:04:37 -0600 [thread overview]
Message-ID: <20001212220437.A491@dan.emsphone.com> (raw)
In-Reply-To: <20001212184156.I11810@rmtc>; from "Steve Talley" on Tue Dec 12 18:41:56 GMT 2000
In the last episode (Dec 12), Steve Talley said:
> Is there a compact version of the following:
>
> fred=(one two three)
> export FRED=$fred[2]
> unset fred
>
> I am looking for something like
>
> export FRED=(one two three)[2]
Assuming "one two three" is actually stored in a shell variable (we'll
call it a):
export FRED=${${=a}[2]}
will work. = turns on SH_WORD_SPLIT, essentially turning the variable
into an array temporarily.
--
Dan Nelson
dnelson@emsphone.com
next prev parent reply other threads:[~2000-12-13 4:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-13 1:41 Steve Talley
2000-12-13 4:04 ` Dan Nelson [this message]
2000-12-13 4:06 ` Bart Schaefer
2000-12-13 17:05 ` Steve Talley
2000-12-13 17:39 ` Bart Schaefer
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=20001212220437.A491@dan.emsphone.com \
--to=dnelson@emsphone.com \
--cc=stephen.talley@sun.com \
--cc=zsh-users@sunsite.auc.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).