From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5861 invoked from network); 13 Aug 2003 23:10:31 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Aug 2003 23:10:31 -0000 Received: (qmail 887 invoked by alias); 13 Aug 2003 23:08:52 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6467 Received: (qmail 867 invoked from network); 13 Aug 2003 23:08:52 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 13 Aug 2003 23:08:52 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [213.46.243.18] by sunsite.dk (MessageWall 1.0.8) with SMTP; 13 Aug 2003 23:8:49 -0000 Received: from s.hn.org ([80.111.3.215]) by amsfep12-int.chello.nl (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with SMTP id <20030813230848.FFID1274.amsfep12-int.chello.nl@s.hn.org> for ; Thu, 14 Aug 2003 01:08:48 +0200 Received: (qmail 800 invoked by uid 1000); 13 Aug 2003 23:08:48 -0000 Date: Thu, 14 Aug 2003 01:08:48 +0200 From: Haakon Riiser To: zsh-users@sunsite.dk Subject: Re: [[ ... ]], [ ... ], bash, zsh Message-ID: <20030813230848.GA670@s.chello.no> Mail-Followup-To: zsh-users@sunsite.dk References: <20030813221633.GA1343@s.chello.no> <87ptj9ch5b.fsf@lucien.dreaming> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87ptj9ch5b.fsf@lucien.dreaming> User-Agent: Mutt/1.4.1i [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