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/ksh
echo ""
echo " = K+WA =";
WA_PORT="`cat /usr/kplushome/entities/Standalone/config/kondor.active |grep PORTAL_PORT|cut -d '&' -f 2`"
#== Checking Tomcat of WebAccess
printf "%25s" Tomcat
touch /usr/kplushome/entities/Standalone/config/webaccess/WebaccessDomainTomcat/bin/tomcat-*.pid
PID=`cat /usr/kplushome/entities/Standalone/config/webaccess/WebaccessDomainTomcat/bin/tomcat-*.pid`
if [[ $PID = "" ]];then
echo " x 0"
else
PSPID=`/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}'
else
echo " x 0"
fi
fi
PORT_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.
$PSPID
or$PID
is empty at line 15 at script runtime? – coffeMug Feb 15 '16 at 8:28echo "PSPID is:$PSPID and PID is:$PID"
. Something like that. – coffeMug Feb 16 '16 at 9:40