From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18740 invoked by alias); 1 Oct 2012 18:21:57 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17303 Received: (qmail 20373 invoked from network); 1 Oct 2012 18:21:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, HTML_MESSAGE,RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at spf-00082601.pphosted.com designates 67.231.145.42 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : content-type : mime-version; s=facebook; bh=pUcve2gSm8cu+6WIPwvwPVRtsYJy92iGzaiTZccOICo=; b=j5/niB4g78Hnw503qC1CQRfViKahuH6OwfAyZbycTGnZ2DghfsLQwIQBC85DeGUNwB11 /c1oQF4f78RlFoXp4LYU2lfFhGNKmLm/wbfEy7aSaYStYdGdrQW1L4XcRbVmvwMwwAYS /+YK4OoTkMMg4/ha6Xz47XwJ2kZqQ1WO/tk= From: Larry Schrof To: "zsh-users@zsh.org" Subject: Bug / error in manpage. Thread-Topic: Bug / error in manpage. Thread-Index: AQHNn//GKajF7pQVzUGqlU64C195lA== Date: Mon, 1 Oct 2012 18:08:36 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [192.168.18.254] Content-Type: multipart/alternative; boundary="_000_CC8F2A379567larrysfbcom_" MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855,1.0.431,0.0.0000 definitions=2012-10-01_03:2012-10-01,2012-10-01,1970-01-01 signatures=0 --_000_CC8F2A379567larrysfbcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I have found an error in the manpage, or incomplete functionality - whatever you'd like to call it. If you are new to zsh and want to learn a couple of things, read on. If you are a veteran and just want to read about the bug, jump to the string '=3D=3D=3D' below in this email. Context Let's say I have a string that contains words separated by some arbitrary token. I'll pick a line from /etc/passwd: zsh% string=3D$(grep '^nobody' /etc/passwd) $() is the same as backticks, but better. zsh% print $string nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false Let's say we want to get the value of the second field. Let's try something naive: zsh% print $string[2] o zsh% That doesn't work - by default it indexes on characters if it's a scalar. Let's use the split-on-word flag: zsh% print $string[(w)2] User:/var/empty:/usr/bin/false Nope - that's not what we want. It split on whitespace. We want to tell it to split on colons: zsh% print $string[(ws{:})2] * zsh% Excellent that's what we want! =3D=3D=3D The man page for subscripting flags is incorrect. Here is the excerpt: The flags s, n and b take an argument; the delimiter is shown below = as `:', but any character, or the matching pairs `(...)', `{...= }', `[...]', or `<...>', may be used. The '< >' brackets do not work as separators: zsh% print $string[(ws<:>)2] zsh: parse error near `)' zsh% This is exactly like the previous command, except the curly braces were cha= nged to arrow brackets. Can we either update the manpage, removuing mention of '<...>', or add the = ability to parse them? Thanks! =3D=3D=3D --_000_CC8F2A379567larrysfbcom_--