Date: Tue, 28 Dec 1999 17:14:59 -0800 (PST) From: "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net> To: andrews@TECHNOLOGIST.COM (Will Andrews) Cc: peter.jeremy@alcatel.com.au (Peter Jeremy), freebsd-stable@FreeBSD.ORG Subject: Re: /bin/test broken ? Message-ID: <199912290115.RAA71526@gndrsh.dnsmgr.net> In-Reply-To: <XFMail.991228200601.andrews@TECHNOLOGIST.COM> from Will Andrews at "Dec 28, 1999 08:06:01 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912290115.RAA71526>