Can you use logical operators in a case statement (bash)?

I'm pretty sure I already know the answer to this, but I want to make sure I'm not overlooking anything. I'm working on a log monitoring script and every 10 lines I want to display a summary of events. The thing is, there are a lot of possible events, that likely won't have happened, so I only want to include them in the summary if they've actually happened.

Right not I'm doing this through mulitple if statements, but that's incredibly ugly... I'm wondering if it's possible to do something like this (which does not work):

#!/bin/bash
a=5

case -n in
        $a)
        echo "yep"
        ;;
esac

The only other solution I could come up with was to write a function along these lines:

checkExist ()
{
if [[ -n $1 ]];then

case $1 in
possibleVariable)
yadda
;;
esac

fi
}

Actually, now that I'm typing all of this out...I think that's how I'll go about it, but I'm still curious if you can use logic in case, or if it's just string matching.

In case anyone cares, here is my script thus far (it's still in progress, so the formatting may be off)

#!/bin/bash
######################################################
# Program:      logTail.sh
# Date Created: 3 June 2010
# Date Updated: NA
# Developer:    DeCoTWC (Support Engineer)
# Description:  Tails manager log and plays a single chirp for warnings and a double chirp for errors
######################################################
i=0
attempts=0
complete=0
live=0
streams=0
startTime=$(tail /opt/XXX/logs/manager.log|head -1|awk '{print $1,$2}')
missingRecent=0
dubFeed ()
{
        echo && echo && echo && echo
}
sep ()
{
        printf "+-++-++-++-++-++-++-++-++-++-+++-++-++-++-++-++-++-++-++-++-++-++-++-++-++\n"
}


tail -100 /opt/XXX/logs/manager.log|
    while read line;do
        line=($line)

            case "${line[6]}" in
                33102)
                    x=$(echo "${line[*]}"|awk '{print $13}')
                    y=$(echo "${line[*]}"|awk '{print $17}')
                    complete=$(($complete+$x))
                    attempts=$(($attempts+$y))
                ;;
                33085)
                    live=$(($live+1))
                    liveRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17030)
                    streams=$(($streams+1))
                    streamRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17031)
                    missingAsset=$(($missingAsset+1))
                    missingRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17023)
                    EOS=$(($EOS+1))
                    EOSRECENT=$(echo "${line[0]}" "${line[1]}")
                ;;
           esac





            if [[ "${line[2]}"  == "E" ]];then
                echo "${line[*]}"
                printf "\a"
                sleep .5
                printf "\a"
                sleep .5
                let i=i+1
            elif [[ "${line[2]}"  == "W" ]] && [[ "${line[8]}" != NTP ]];then
                echo "${line[*]}"
                printf "\a"
                sleep .5
                let i=i+1
            else
                echo "${line[*]}"
                let i=i+1
            fi
            if [[ $i -eq 10 ]];then
                dubFeed
                sep
                printf "Summary since $startTime\n"
                printf "$complete Successful of $attempts recordings\n"
                printf "$live live recordings started \t Most recent at $liveRecent\n"
                printf "$streams successful sessions set up \t Most recent at $streamRecent\n"
                if [[ -n $missingAsset ]];then
                printf "$missingAsset session failures due to missing assets. \t Most recent at $missingRecent\n"
                fi

                sep
                dubFeed
                i=0
            fi
    done

---------- Post updated 07-14-10 at 03:37 AM ---------- Previous update was 07-13-10 at 01:16 PM ----------

In case anyone cares...

This is the (more or less) finished project. It's still a bit wonky in places, and I'd appreciate any input on how I could have streamlined this, or made it more efficient

[root@mgmt01 utils]# cat logTail.sh
#!/bin/bash
######################################################
# Program:      logTail.sh
# Date Created: 3 June 2010
# Date Updated: 13 July 2010
#               |_Added summary
#               |_formatting fixes
# Developer:    DeCoTWC (Support Engineer)
# Description:  Tails manager log and plays a single chirp for warnings and a double chirp for errors
######################################################

#Colour variables
#################
pur='\e[0;35m'
nc='\e[0m'



#Zero out all values
####################
i=0
attempts=0
complete=0
ingestFail=0
live=0
streams=0
underFlow=0
writeFail=0
startTime=$(tail /opt/XXX/logs/manager.log|head -1|awk '{print $1,$2}')
missingRecent=0
EOS=0
phantom=0

#Function to insert two blank lines
###################################
dubFeed ()
{
        echo && echo
}

#Function to draw separator
###########################
sep ()
{
        printf "${pur}+-++-++-++-++-++-++-++-++-++-+++-++-++-++-++-++-++-++-++-++-++-++-++-++-++${nc}\n"
}

#Function to check for each kind of log entry, and print running totals
#######################################################################
sumVerify ()
{
        if [[ $1 -ne 0 ]];then
        case $1 in
                        $EOS)
                printf "$EOS sessions torn down due to EOS or Pause. \t Most recent at $EOSRECENT\n"
                ;;
                        $missingAsset)
                printf "$missingAsset session failures due to Missing Assets \t Most recent at $missingRecent\n"
                ;;
                        $deletedAsset)
                printf "$deletedAsset assets deleted. \t\t\t\t Most recent at $deletedRecent\n"
                ;;
                        $live)
                printf "$live live recordings started \t\t\t Most recent at $liveRecent\n"
                ;;
                        $complete)
                printf "$complete Successful of $attempts recordings\n"
                ;;
                        $streams)
                printf "$streams successful sessions set up \t\t Most recent at $streamRecent\n"
                ;;
                        $phantom)
                printf "$phantom phantom asset deletion requests \t\t Most recent at $phantomRecent\n"
                ;;
                        $ingestFail)
                printf "$ingestFail generic ingest failures \t Most recent at $ingestRecent\n"
                ;;
                        underFlow)
                printf "$ingestFail ingest failures due to underflow \t Most recent at $underRecent\n"
                ;;
                        writeFail)
                printf "$writeFail ingest failures due to write fail \t Most recent at $writeRecent\n"
        esac
        fi
}

#Start tailing log and breaking down informaiton
################################################
tail -F /opt/XXX/logs/manager.log|
    while read line;do
        line=($line)

            #Start parsing each line of the logs to see if it's a known value we're checking for
            ####################################################################################
            case "${line[6]}" in
                33102)
                    x=$(echo "${line[*]}"|awk '{print $13}')
                    y=$(echo "${line[*]}"|awk '{print $17}')
                    complete=$(($complete+$x))
                    attempts=$(($attempts+$y))
                ;;
                33085)
                    live=$(($live+1))
                    liveRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17030)
                    streams=$(($streams+1))
                    streamRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17031)
                    missingAsset=$(($missingAsset+1))
                    missingRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                17023)
                    EOS=$(($EOS+1))
                    EOSRECENT=$(echo "${line[0]}" "${line[1]}")
                ;;
                33079)
                    deletedAsset=$(($deletedAsset+1))
                    deletedRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                33078)
                    phantom=$(($phantom+1))
                    phantomRecent=$(echo "${line[0]}" "${line[1]}")
                ;;
                33048)
                    if [[ "${i[13]}" == "(50409)" ]];then
                        underFlow=$(($underflow+1))
                        underRecent=$(echo "${line[0]}" "${line[1]}")
                    elif [[ "${i[13]}" == "(50009)" ]];then
                        writeFail=$(($writeFail+1))
                        writeRecent=$(echo "${line[0]}" "${line[1]}")
                    else
                        ingestFail=$((ingestFail+1))
                        ingestRecent=$(echo "${line[0]}" "${line[1]}")
                    fi
           esac

            #Check if each log line is an error. If so, ring system bell twice
            ##################################################################
            if [[ "${line[2]}"  == "E" ]];then
                echo "${line[*]}"
                printf "\a"
                #sleep .5
                printf "\a"
                #sleep .5
                let i=i+1
            #Check if each line is a warning. If so ring system bell once
            #############################################################
            elif [[ "${line[2]}"  == "W" ]] && [[ "${line[8]}" != NTP ]];then
                echo "${line[*]}"
                printf "\a"
                #sleep .5
                let i=i+1
            else
                echo "${line[*]}"
                let i=i+1
            fi
            #If 10 log lines have passed, print summary and reset counter
            #############################################################
            if [[ $i -eq 10 ]];then
                dubFeed
                sep
                printf "Summary since $startTime\n"
                sumVerify $complete
                                sumVerify $live
                                sumVerify $streams
                                sumVerify $deletedAsset
                                sumVerify $missingAsset
                                sumVerify $EOS
                                sumVerify $phantom
                                printf "Time now is $(date "+%D %H:%M:%S")\n"
                sep
                dubFeed
                i=0
            fi
    done