Double square brackets question

Hi,
I just came across an interesting shell script syntax like the one below:

[[ $mode =  "INTERACTIVE" ]] && (trap 'rm -rf ${WORK_DIR}/*.$$; echo "\n\nInterrupted !!\n\n"; exit 4' 1 2 3 15)

Can someone please explain the code snippet above?
The trap command bit is fine but [[ $mode = "INTERACTIVE" ]] && is the hazy part.
Generally we use an if before [[ ]], but it is not being used here!

I was also experimenting with the below code snippet and it seemed to work fine as long as I was not putting #! /usr/bin/ksh at the top of the script.

[[ `ps -ef | grep Hawkmoon | grep -v grep` ]]

Why is it that it is running sans #! /usr/bin/ksh only?
I am using Solaris 5.8 by the way.
Thanks in advance :).

High King Nothing,

man ksh:

[[ expression ]]
              Evaluates expression and returns a zero exit status when expression is true.  
See Conditional Expressions below, for a description of expression.
expression1 && expression2
              True, if expression1 and expression2 are both true.

The && construct makes use of the fact that in order to find out whether both expressions are true, first the left side gets evaluated. Because of efficiency the right side only gets evaluated if the left side is true. If the left side is false it does not matter what value the right side evaluates to, so it never gets evaluated. Thus this happens to work out like an if then construction. The end value of the && construct then never gets used. I personally prefer the if then else way of testing conditions since it usually provides cleaner, more legible code.

I don't know why the examples you provide don't work with ksh. They sure work in my ksh (does /usr/bin/ksh exist on your system?). The first example strikes me as strange because of the parentheses, which mean the trap statement is run in a separate environment, so it will never output the statements in the current environment. If you use { .. ;} instead it will work:

[[ $mode =  "INTERACTIVE" ]] && {trap 'rm -rf ${WORK_DIR}/*.$$; echo "\n\nInterrupted !!\n\n"; exit 4' 1 2 3 15;}

The double brackets are a non-standard syntax supported only by a few shells. Use single brackets instead; they will work everywhere.