Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [[ ... ]], [ ... ], bash, zsh
- X-seq: zsh-users 6467
- From: Haakon Riiser <haakon.riiser@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: [[ ... ]], [ ... ], bash, zsh
- Date: Thu, 14 Aug 2003 01:08:48 +0200
- In-reply-to: <87ptj9ch5b.fsf@xxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030813221633.GA1343@xxxxxxxxxxx> <87ptj9ch5b.fsf@xxxxxxxxxxxxxxx>
[Björn Lindström]
>> In both bash and zsh, the "-n" operator in [ ... ] is optional, but in
>> [[ ... ]] it's only optional in bash. Is there a reason for this?
> If you use [ ], the test is supposed to work like with test(1). In the
> case of zsh this is still handled by a built-in, I don't know how it is
> with bash. The [[ syntax is a shell-specific extension, and there are
> several differences between the shells on how the are interpreted.
Okay, I thought the [[ ... ]] command was mentioned in POSIX.
Still, it seems strange that [[ ... ]] and [ ... ] would differ
with regard to the -n operator;
if [[ $INITIALIZED ]]; then
...
fi
reads better than
if [[ -n $INITIALIZED ]]; then
...
fi
so I just wanted to know why it was decided that -n should not
be optional. (No, it's not important, but I'd feel better if I
knew the reason. :-)
--
Haakon
Messages sorted by:
Reverse Date,
Date,
Thread,
Author