I am encountering a problem when I try to run a script in RedHat OS. I get an arithmetic syntax error.Now here's the script that I am trying to run: #!/bin/kshecho echo  = K+WA =;WA_PORT=`cat /usr/kplushome/entities/Standalone/config/kondor.active |grep PORTAL_PORT|cut -d '&' -f 2`#== Checking Tomcat of WebAccessprintf %25s Tomcattouch /usr/kplushome/entities/Standalone/config/webaccess/WebaccessDomainTomcat/bin/tomcat-*.pidPID=`cat /usr/kplushome/entities/Standalone/config/webaccess/WebaccessDomainTomcat/bin/tomcat-*.pid`if [[ $PID =  ]];thenecho  x 0elsePSPID=`/bin/ps -eo pid | grep -w $PID`if [[ $PSPID -eq $PID ]];then/bin/ps -ef | grep $PID | grep -v grep | awk 'NR==1 {print  = $8 $9 $10 $11 $12 $13 $14 $15}'elseecho  x 0fifiPORT_STATUS=`netstat -an | grep ${WA_PORT} | grep LISTEN | perl -pe s/^.+\n/LISTENING/g;`PORT_STATUS=${PORT_STATUS:=NOT LISTENING!!!}echo  Port ${WA_PORT}/TCP = ${PORT_STATUS}cd /usr/kplushome/entities/Standalone/config/webaccess/WebaccessServer/etc(PATH=/usr/ucb:$PATH; ./checkall.sh;) | perl -pe s,^, ,g;echo Problem is I don't see anything wrong with my line 15 as I don't see any rule from unix that was violated for it to have an arithmetic syntax error, or am I missing something? May I ask for any advice from you experts? Any help would be much appreciated. Thank you. 
Arithmetic Syntax Error when running a script in RedHat OS
linux;shell script;scripting
The error message shows two numbers. These seem to be process ids. A likely answer is that your line PID=`cat /usr/kplushome/entities/Standalone/config/webaccess/WebaccessDomainTomcat/bin/tomcat-*.pid`is finding 2 files and you are getting these 2 pids set in the variable, separated by a newline. When used in if [[ $PSPID -eq $PID ]] you will have 2 numbers after the -eq, which is the syntax error.You should doublequote your variables (eg $PID) to avoid this type of syntax error, though clearly the real problem is that you had 2 numbers instead of 1. Depending on what is legal for your situation, you could simply add a loop handling each pid separately (for pid in $PID...).