views:

30

answers:

1

I thought C shell script will behave like C and use short circuit evaluation for logical operators.

if ((! -e $cache ) || ("`find $monitor -newer $cache`" != "")) then
...
endif

But in the if statement, even if the first condition is true, the second is checked giving me errors.

Do we have a short circuit logical OR in C shell script?

A: 

Usually, &&and || are short-circut. Consider something like this:

$ false && echo foo
$ true || echo foo

In both cases, foo won't be put out.

But, AFAIK you cannot use this kind of string comparison like this, even if short-circuit, csh will still syntax-check the whole thing.

FUZxxl