Modifying `whatis` to return error code for missing commands
PIPESTATUS is an array. Since you only need $[PIPESTATUS[0]}, the subscript can be omitted.

(
    code=0
    while [ "$1" != "" ]
    do
        found=0
        for d in /var/cache/man $manpath /usr/lib
        do
            if [ -f $d/whatis ]
            then
                if grep -"$grepopt1" "$grepopt2""$1" $d/whatis
                then
                    found=1
                fi
            fi
        done

        if [ $found = 0 ]
        then
            echo "$1: nothing appropriate"
            code=1
        fi

        shift
    done
    exit $code
) | eval ${PAGER:-more -E}
return $PIPESTATUS


From man bash:

   PIPESTATUS
          An array variable (see Arrays below) containing a list  of  exit
          status  values  from the processes in the most-recently-executed
          foreground pipeline (which may contain only a single command).