From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17920 invoked from network); 10 Oct 2001 17:44:49 -0000 Received: from unknown (HELO sunsite.dk) (130.225.247.90) by ns1.primenet.com.au with SMTP; 10 Oct 2001 17:44:49 -0000 Received: (qmail 25525 invoked by alias); 10 Oct 2001 17:44:35 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4366 Received: (qmail 25512 invoked from network); 10 Oct 2001 17:44:35 -0000 Date: Wed, 10 Oct 2001 10:44:33 -0700 From: Will Yardley To: zsh-users@sunsite.dk Subject: Re: conditional expressions (incompatible with ksh) Message-ID: <20011010104433.E12567@hq.newdream.net> Mail-Followup-To: zsh-users@sunsite.dk References: <20011010123540.A5835@pelennor.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20011010123540.A5835@pelennor.net> User-Agent: Mutt/1.3.23i Organization: New Dream Network lists@pelennor.net wrote: > So I have a ksh script which tests to see if a file exists like so: > > if [ -a file ]; then > This works correctly in both ksh and bash. However, in zsh (both the > normal mode, and the ksh compatible mode), the -a operator is only > interpreted as boolean AND, never as "file exists" in the appropriate > context. perhaps someone can give a more detailed answer, but the '-a' operator isn't mentioned in my bash scripting book, and i've never seen this operator used (although i'll admit it works in bash and not in zsh). how about using instead.... -e file exists -f file exists and is a regular file (ie not a directory) -s file exists and is not empty i'd guess -f or -e is probably what you want and should work in bash, ksh and zsh. w -- GPG Public Key: http://infinitejazz.net/will/pgp/