zsh-users
 help / color / mirror / code / Atom feed
* how to force scalar to be an array?
@ 2004-08-27 15:49 Andy Spiegl
  2004-08-27 21:15 ` Bart Schaefer
  2004-08-27 21:27 ` Bart Schaefer
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Spiegl @ 2004-08-27 15:49 UTC (permalink / raw)
  To: ZSH User List

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-30 16:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-27 15:49 how to force scalar to be an array? Andy Spiegl
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

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).