From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by melb.werple.net.au (8.7.5/8.7.3/2) with ESMTP id IAA20733 for ; Sun, 23 Jun 1996 08:43:26 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id SAA19130; Sat, 22 Jun 1996 18:26:31 -0400 (EDT) Resent-Date: Sat, 22 Jun 1996 18:26:31 -0400 (EDT) From: "Bart Schaefer" Message-Id: <960622152729.ZM9904@candle.brasslantern.com> Date: Sat, 22 Jun 1996 15:27:26 -0700 Reply-To: schaefer@nbn.com X-Mailer: Z-Mail (4.0b.607 07jun96) To: zsh-workers@math.gatech.edu Subject: Treating $(...) as an array MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"IRGLJ2.0.qg4.MC7pn"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/1425 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu You can force $(...) to be interpreted as an array when assigning it to a variable: zsh% x=($(print -l "One two" "Three four" "Five six")) zsh% echo $#x 6 You can force a string variable to be interpreted as an array: zsh% x="$(print -l "One two" "Three four" "Five six")" zsh% echo ${x[2]} ${x[(w)2} ${x[(f)2]} n two Three four You can use $(...) as a string substitution inside ${...}: zsh% echo ${(L)$(print -l "One two" "Three four" "Five six")} one two three four five six You can use modifiers on $(...) when it appears as a string substitution: zsh% echo ${$(print -l "One two" "Three four" "Five six"):l} one two three four five six So, WHY can't you force $(...) to be interpreted directly as an array when it appears as a string substitution? zsh% echo ${$(print -l "One two" "Three four" "Five six")[(f)2]} zsh: closing brace expected -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.nbn.com/people/lantern New male in /home/schaefer: >N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"