From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14869 invoked from network); 26 Feb 2002 22:17:41 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 26 Feb 2002 22:17:41 -0000 Received: (qmail 26502 invoked by alias); 26 Feb 2002 22:17:30 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16724 Received: (qmail 26487 invoked from network); 26 Feb 2002 22:17:30 -0000 Date: Tue, 26 Feb 2002 14:17:10 -0800 (PST) From: Bart Schaefer Sender: To: DervishD cc: Subject: Re: About 'test' compatibility In-Reply-To: <3C7C00A1.mail3E1WHBAN@viadomus.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Tue, 26 Feb 2002, DervishD wrote: > >No, it's the -d in $DEFAULT that's confusing it. When $DEFAULT is > >-d, zsh is treating the above as "if there is a directory named `=' > >..." > > Just curiosity: why BASH doesn't fail here too? The 'test' > builtin of the Bourne shell has the '-d' too. It appears that bash gives the infix '=' higher precedence than the prefix '-d' or the infix '-a': bash2-2.03$ mkdir '=' bash2-2.03$ if [ "-d" = ]; then echo There is a directory; fi There is a directory bash2-2.03$ if [ -d = -x ]; then echo There is a directory; fi bash2-2.03$ if [ -d = -a x ]; then echo There is a directory; fi [: too many arguments bash2-2.03$ if [ -d . -a x ]; then echo There is a directory; fi There is a directory I haven't checked whether e.g. POSIX says anything about this.