From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1156 invoked from network); 28 Sep 1998 14:20:47 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 28 Sep 1998 14:20:47 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id KAA04355; Mon, 28 Sep 1998 10:11:19 -0400 (EDT) Resent-Date: Mon, 28 Sep 1998 10:11:19 -0400 (EDT) Message-Id: <9809281401.AA32041@ibmth.df.unipi.it> To: zsh-workers@math.gatech.edu Cc: johsu650@student.liu.se Subject: Re: Manpage improvement In-Reply-To: "=?ISO-8859-1?Q?Johan_Sundstr=F6m?="'s message of "Sun, 27 Sep 1998 17:47:48 DFT." Date: Mon, 28 Sep 1998 16:00:28 +0200 From: Peter Stephenson Resent-Message-ID: <"y84zA2.0.-31.6av3s"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4401 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > x11amp "${(@f)$(locate Argentina|grep .mp3)}" > > I hope this might qualify as an example to spice up future zsh > manpages. Here's a change to the manual source which should make this sort of thing a little clearer. (You only need the (@) flag with array words, not when splitting a single value into words.) *** Doc/Zsh/expn.yo.par Thu Jul 9 12:09:43 1998 --- Doc/Zsh/expn.yo Mon Sep 28 15:53:57 1998 *************** *** 301,308 **** If a tt(${)...tt(}) type parameter expression or a tt($LPAR())...tt(RPAR()) type command substitution is used in place of var(name) above, it is substituted first ! and the result is used as it were the value of var(name). If the opening brace is directly followed by an opening parenthesis, the string up to the matching closing parenthesis will be taken as a list of flags. Where arguments are valid, any character, or the --- 301,313 ---- If a tt(${)...tt(}) type parameter expression or a tt($LPAR())...tt(RPAR()) type command substitution is used in place of var(name) above, it is substituted first ! and the result is used as it were the value of var(name). Thus it is ! possible to perform nested operations: tt(${${foo#head}%tail}) ! prints the variables tt($foo) after deleting both the head and tail from ! the value. The form with tt($LPAR())...tt(RPAR()) is often useful in ! combination with the flags described next; see the example below. + subsect(Flags) If the opening brace is directly followed by an opening parenthesis, the string up to the matching closing parenthesis will be taken as a list of flags. Where arguments are valid, any character, or the *************** *** 414,419 **** --- 419,435 ---- Include the length of the match in the result. ) enditem() + subsect(Example) + The flag tt(f) is useful to split a double-quoted substitution line by + line. For example, + + nofill(var(cmd) tt("${)tt(LPAR()f)tt(RPAR()$)tt(LPAR()<)var(file)tt(RPAR()}")) + + will substitue the contents of var(file) divided so that one line is + supplied per argument to var(cmd). Compare this with the effect of + tt($)tt(LPAR()<)var(file)tt(RPAR()) alone, which divides the file + up by words, or the same inside double quotes, where the entire + contents of the file are passed as a single argument. texinode(Command Substitution)(Arithmetic Expansion)(Parameter Expansion)(Expansion) sect(Command Substitution) cindex(command substitution) -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Gruppo Teorico, Dipartimento di Fisica Piazza Torricelli 2, 56100 Pisa, Italy