zsh-users
 help / color / mirror / code / Atom feed
From: Andy Spiegl <zsh.Andy@spiegl.de>
To: zsh-users@sunsite.dk
Subject: Re: how to force scalar to be an array?
Date: Mon, 30 Aug 2004 18:39:25 +0200	[thread overview]
Message-ID: <20040830163925.GB3639@spiegl.de> (raw)
In-Reply-To: <Pine.LNX.4.61.0408280806540.10647@toltec.zanshin.com>

Hi Bart,

> What I meant was:
> 
> 	words=( $=result )
> 	print $words[1]
Ah!  Thanks so much once again for your help.

> You can even do it in one expression:
> 
> 	print ${${(A)=words::=$result}[1]}
Cool.  But hard to read.

> You'd also think that the (@) flag would fix that, but it only
> *preserves* array-ness in the transition from inner to outer nested
> expansions, it doesn't *create* array-ness from a scalar.
Yep, I did think that.  So maybe your suggestion below would be worth
discussion on zsh-workers. :-)

> The latter might be something we could consider changing without much risk
> of breaking anything.

> You can do that latter one in zsh, too, if you have extendedglob set:
> 
> 	: ${result//(#b)([^[:space:]]#)(*)/}
> 	print -l $match[1] $match[2]
Uffda, gotta go back and read more of the zsh manual.

Thanks again, I really appreciate your help!
 Andy.

-- 
                              o      _     _         _
  ------- __o       __o      /\_   _ \\o  (_)\__/o  (_)          -o)
  ----- _`\<,_    _`\<,_    _>(_) (_)/<_    \_| \   _|/' \/       /\\
  ---- (_)/ (_)  (_)/ (_)  (_)        (_)   (_)    (_)'  _\o_    _\_v
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Life is like a box of chocolates.
 You never know what you get.  (Forrest Gump, 1994)


      reply	other threads:[~2004-08-30 16:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-27 15:49 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 [this message]

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=20040830163925.GB3639@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).