I have seen many posts for this sort of problem but I just did not know how to use it for my issue. A number is assigned to a variable and I wanted to check if it is a zero or non zero.
Example of my numbers are below:
000000000000000000000000000000000000000000000000
574E47303030303030303030303030303030303135313937
So "000000000000000000000000000000000000000000000000" is considered as zero and the other as non zero right, but how would I do that using IF statement?
The following is my script
Quote:
function getCorrelID {
cd /home/mqm/ma01
CORRELID=`./q -i$QUEUENAME -L1 -ddf2 2>&1 | sed -n '/Correl/{n;p;}' | sed 's/^[ \t]*//'`
echo $CORRELID
}
while read LINE
do
QUEUENAME=`echo $LINE | cut -d "," -f1`
echo $QUEUENAME
getCorrelID
if [ $CORRELID -eq "0" ]; then
echo "Null"
else
echo "Not Null"
fi
done<QueueList
The following is my output saying that the number "574E47303030303030303030303030303030303135313937" is not valid for the command.
Quote:
Output:
000000000000000000000000000000000000000000000000
Null
000000000000000000000000000000000000000000000000
Null
000000000000000000000000000000000000000000000000
Null
574E47303030303030303030303030303030303135313937
./correlid.sh[13]: 574E47303030303030303030303030303030303135313937: The specified number is not valid for this command.
Not Null
Please let me know if there are any suggestions on this.
Thank you!!