From: Andy Spiegl <zsh.Andy@spiegl.de>
To: ZSH User List <zsh-users@sunsite.dk>
Subject: how to force scalar to be an array?
Date: Fri, 27 Aug 2004 17:49:05 +0200 [thread overview]
Message-ID: <20040827154905.GA26846@spiegl.de> (raw)
Sorry, guys, one more question:
I've got this:
result=`some_proggie`
first_word=${${=result}[1]}
rest_words=${${=result}[2,-1]}
But this works as expected only if result contains more than one word.
An example:
$ result="foo bar baz"
$ print -c ${${=result}[1]}
foo
$ result="foo"
$ print -c ${${=result}[1]}
f
I also tried this:
$ print -c ${${(@)=result}[1]}
f
What am I doing wrong here?
Oh, boy what a day! :-(
Andy.
--
o _ _ _
------- __o __o /\_ _ \\o (_)\__/o (_) -o)
----- _`\<,_ _`\<,_ _>(_) (_)/<_ \_| \ _|/' \/ /\\
---- (_)/ (_) (_)/ (_) (_) (_) (_) (_)' _\o_ _\_v
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Warning: This email, when printed on paper, has sharp edges.
Handle with care or serious injury may result.
next reply other threads:[~2004-08-27 15:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-27 15:49 Andy Spiegl [this message]
2004-08-27 21:15 ` Bart Schaefer
2004-08-27 21:27 ` Bart Schaefer
2004-08-28 7:43 ` Andy Spiegl
2004-08-28 18:08 ` Bart Schaefer
2004-08-30 16:39 ` Andy Spiegl
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=20040827154905.GA26846@spiegl.de \
--to=zsh.andy@spiegl.de \
--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).