Unless sh and ksh on HP-UX are terribly broken (which I doubt), you'veQuote:>On HP 10.20, I am running a script which contains the following lines:
>if [ -z "$QUE" ]
>then echo "$PROC is not started on $HOST." >> $LOG
>else if [ "$QUE" -ge $THRESHOLD ]
>then
>navcmd start $PROC
>echo "$PROC on $HOST exceeded $THRESHOLD, additional processes were star ted
>at `date`." >> $LOG
>When I run the script from the command line (or in an "at" statement), if $QUE
>is equal to 0 (zero), then [ -z "$QUE" ] is true and the script reports
>correctly.
>However when I run the script from cron, if $QUE is equal to 0 (zero), then [
>-z "$QUE" ] is false and the script reports erroneous information.
>I have tried both sh and ksh on HP-UX with the same results.
misinterpreted your results. -z is used to test for whether a string has zero
length, *not* for whether it is a number with value 0. 0 is a string with
length 1, so [ -z 0 ] will always be false. To test for whether the string is
equal to 0, use -eq 0.
John
--