From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29067 invoked from network); 5 Jun 2003 00:10:02 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 5 Jun 2003 00:10:02 -0000 Received: (qmail 5011 invoked by alias); 5 Jun 2003 00:09:47 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6153 Received: (qmail 5003 invoked from network); 5 Jun 2003 00:09:46 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 5 Jun 2003 00:09:46 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [207.217.120.50] by sunsite.dk (MessageWall 1.0.8) with SMTP; 5 Jun 2003 0:9:46 -0000 Received: from cpe-24-221-169-78.ca.sprintbbd.net ([24.221.169.78] helo=ckhb.org) by avocet.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19NiK8-0004a2-00 for zsh-users@sunsite.dk; Wed, 04 Jun 2003 17:09:45 -0700 From: "S. Cowles" Reply-To: scowles@earthlink.net Organization: personal To: zsh-users@sunsite.dk Subject: Re: Bad "bad pattern" in ${foo//pat/repl} ? Date: Wed, 4 Jun 2003 17:09:38 -0700 User-Agent: KMail/1.5 References: <1F95A0A7.2A3D4E3C.37FA9B8A@netscape.net> In-Reply-To: <1F95A0A7.2A3D4E3C.37FA9B8A@netscape.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Description: clearsigned data Content-Disposition: inline Message-Id: <200306041709.41497.scowles@earthlink.net> almost a year ago, Bart Schaefer added the following note to the email=20 archives: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =46rom: "Bart Schaefer" To: zsh-workers@xxxxxxxxxx Subject: Bad "bad pattern" in ${foo//pat/repl} ? Date: Sat, 13 Jul 2002 21:35:31 +0000 Mailing-list: contact zsh-workers-help@sunsite.dk; run by ezmlm =20 (Never mind why the elements of $foo have spaces in them, I was fooling with something else when I came across this.) schaefer<501> foo=3D("a b" "a c" "b q" "x y") = =20 schaefer<502> echo ${foo/#a*/yes} yes yes b q x y schaefer<503> echo ${foo//#a*/yes}=20 a b a c b q x y schaefer<504> setopt extendedglob=20 schaefer<505> echo ${foo/#a*/yes} yes yes b q x y schaefer<506> echo ${foo//#a*/yes} =20 zsh: bad pattern: #a* Surely both 503 and 506 are bugs (probably the same bug). One should be ab= le to anchor to the beginning of the string even when doing a replace-all (I do admit it doesn't really make sense to do so, but ...). =2D-=20 Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D with 4.1.1-test-3, I am still getting the same erroneous error message for= =20 beginning of string operator (#), and a no-op for the end of string operato= r=20 (%). in each of the following examples, extendedglob is set. 03-06-04 16:44:44 [514] bubo7:scripts/zsh% a=3D" a b c d " ; s=3D" " ; r=3D""= ; \=20 printf "a: >%s<\n" ${a//#${s}/${r}} =20 zsh: bad pattern: # 03-06-04 16:44:55 [515] bubo7:scripts/zsh% a=3D" a b c d " ; s=3D" " ; r=3D""= ; \=20 printf "a: >%s<\n" ${a//%${s}/${r}} =20 a: > a b c d < if they worked, these operations would be superb for left and right string= =20 trims. the work around I've chosen is to use the read builtin to do the=20 whitespace trims. for non-whitespace trims, however, the problem remains. = =20 does anyone have a workaround? scowles at earthlink dot net