From owner-freebsd-stable Tue Dec 28 17:21: 0 1999 Delivered-To: freebsd-stable@freebsd.org Received: from gndrsh.dnsmgr.net (GndRsh.dnsmgr.net [198.145.92.4]) by hub.freebsd.org (Postfix) with ESMTP id 420E115580 for ; Tue, 28 Dec 1999 17:20:57 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.9.3/8.9.3) id RAA71526; Tue, 28 Dec 1999 17:15:00 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <199912290115.RAA71526@gndrsh.dnsmgr.net> Subject: Re: /bin/test broken ? In-Reply-To: from Will Andrews at "Dec 28, 1999 08:06:01 pm" To: andrews@TECHNOLOGIST.COM (Will Andrews) Date: Tue, 28 Dec 1999 17:14:59 -0800 (PST) Cc: peter.jeremy@alcatel.com.au (Peter Jeremy), freebsd-stable@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > On 28-Dec-99 Peter Jeremy wrote: > > $ zsh -c '[ 1 -ne 0 ] && echo correct' > > correct > > $ zsh -c '/bin/[ 1 -ne 0 ] && echo correct' > > zsh: bad pattern: /bin/[ > > $ > > > > (Found by accident whilst looking into the original problem - I haven't, > > but probably should, report it as a bug in zsh 3.0.5). > > I don't think so. It's a regex thing - you're supposed to escape the [ since > it's parsed by the shell as a regex.. (just like parentheses, semicolons, > stars, tildes, and so on). Things inside single quotes (') are not subject to regex unless the shell is broken. From sh(1): Single Quotes Enclosing characters in single quotes preserves the literal mean- ing of all the characters (except single quotes, making it impos- sible to put single-quotes in a single-quoted string). Thus, zsh is broken :-(. Here is a working /bin/csh on FreeBSD 3.3 with a working /bin/[ doing this thing correctly: gndrsh:root {1134}# sh -c '/bin/[ 1 -ne 0 ] && echo correct' correct And a working /bin/sh FreeBSD 3.3 with a working /bin/[ doing this correctly: # sh -c '/bin/[ 1 -ne 0 ] && echo correct' correct -- Rod Grimes - KD7CAX @ CN85sl - (RWG25) rgrimes@gndrsh.dnsmgr.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message