zsh-users
 help / color / mirror / code / Atom feed
* conditional expressions (incompatible with ksh)
@ 2001-10-10 17:35 lists
  2001-10-10 17:44 ` Will Yardley
  2001-10-10 19:15 ` Clint Adams
  0 siblings, 2 replies; 4+ messages in thread
From: lists @ 2001-10-10 17:35 UTC (permalink / raw)
  To: zsh-users

Hello,

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.

According to my "Unix in a Nutshell" book, -a is used for both operators,
and the shell needs to determine the correct use from context.

I realize that I could use [[ ]] instead of [ ] to work around this problem,
but the script needs to remain compatible with other shells, so this isn't
really a good option.

Any idea what the correct behavior should be?

mdr
-- 
Matthew D. Rench


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-10-10 19:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-10 17:35 conditional expressions (incompatible with ksh) lists
2001-10-10 17:44 ` Will Yardley
2001-10-10 19:15 ` Clint Adams
2001-10-10 19:16   ` please take me off of this mailing list Matthew Peter Lyon

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).