Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
how to force scalar to be an array?
- X-seq: zsh-users 7938
 
- From: Andy Spiegl <zsh.Andy@xxxxxxxxx>
 
- To: ZSH User List <zsh-users@xxxxxxxxxx>
 
- Subject: how to force scalar to be an array?
 
- Date: Fri, 27 Aug 2004 17:49:05 +0200
 
- Kinfo: virscan ok
 
- Kinfo: NoRelay, NoSpam
 
- Kreccount: 1
 
- Mail-followup-to: ZSH User List <zsh-users@xxxxxxxxxx>
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author