How to Compare Null values??

Hi,

Can someone help me comparing Null values.
Scenario is as follows:

I have a variable which "cache_prd" which can have either some integer or nothing(Null)

if it is integer I have to again do some comparision but these comparisons give me this error:( "line 32: [: 95: unary operator expected"

To avoid this I used another variable chk= which has null value in it but again at some point when integer comes in variable it gives me same error.

Please suggest me how to catch this error.

Thanks in advance,
Yagami

NULL does not compare to anything, including itself. So, we have two variables $a and $b:

#!/bin/ksh
if [[ -z $a  || -z $b ]] ; then
   echo "cannot compare"
else
   if [[ $a -eq $b ]] ; then
             echo 'equal'
   else
       if [[ $a -gt $b ]] ; then
            echo "$a is greater than $b"
       else
            echo "$a is less than $b"
       fi
   fi 
fi   

Is that what you mean?

If you are aking about shell variables...

[[ "$a" = "$b" ]] && echo equal || echo not equal

The OP wanted to compare integers. I think.