Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: About 'test' compatibility
- X-seq: zsh-workers 16724
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: DervishD <raul@xxxxxxxxxxxx>
- Subject: Re: About 'test' compatibility
- Date: Tue, 26 Feb 2002 14:17:10 -0800 (PST)
- Cc: <zsh-workers@xxxxxxxxxx>
- In-reply-to: <3C7C00A1.mail3E1WHBAN@xxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: <schaefer@xxxxxxxxxxxxxxxx>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author