Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: conditional expressions (incompatible with ksh)
- X-seq: zsh-users 4366
- From: Will Yardley <william@xxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: conditional expressions (incompatible with ksh)
- Date: Wed, 10 Oct 2001 10:44:33 -0700
- In-reply-to: <20011010123540.A5835@xxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: New Dream Network
- References: <20011010123540.A5835@xxxxxxxxxxxx>
lists@xxxxxxxxxxxx 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/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author