> 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)               [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-stable" in the body of the message

Reply via email to