Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Dec 1999 20:06:01 -0500 (EST)
From:      Will Andrews <andrews@TECHNOLOGIST.COM>
To:        Peter Jeremy <peter.jeremy@alcatel.com.au>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: /bin/test broken ?
Message-ID:  <XFMail.991228200601.andrews@TECHNOLOGIST.COM>
In-Reply-To: <99Dec29.104430est.40322@border.alcanet.com.au>

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).

<2 5011-0> (99-12-28 20:02:04) [will@shadow ~]% /bin/\[ 1 -ne 0 && echo correct
correct
<2 5012-0> (99-12-28 20:02:11) [will@shadow ~]% [ 1 -ne 0 ] && echo correct
correct

FWIW:
<2 5002-0> (99-12-28 20:03:38) [will@shadow ~]% pkg_info -Ia | grep zsh
zsh-3.1.6           The Z shell (development version)
<2 5003-0> (99-12-28 20:03:39) [will@shadow ~]% grep will /etc/passwd
will:*:1000:1000:Will Andrews:/home/will:/usr/local/bin/zsh

..although I'm not sure why /bin/[ behaves like this:

<2 5004-0> (99-12-28 20:03:47) [will@shadow ~]% /bin/\[ 1 -ne 0 ] && echo
correct
[: ]: unexpected operator

*shrug* could be some weird kink. :-)

--
Will Andrews <andrews@technologist.com>
GCS/E/S @d- s+:+>+:- a--->+++ C++ UB++++ P+ L- E--- W+++ !N !o ?K w---
?O M+ V-- PS+ PE++ Y+ PGP+>+++ t++ 5 X++ R+ tv+ b++>++++ DI+++ D+ 
G++>+++ e->++++ h! r-->+++ y?


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?XFMail.991228200601.andrews>