I have strings similar to aafafaff45,29.34.942.45,edfdfafa that i want to compare to another similar string to check if they are the same. my script isn't working.
#!/bin/sh
RESULTS=$(curl -s "http://1444.66.44.293:7760/datalocation?transaction_id=126454545454&account_number=45454183521&date_start=1262968108&date_end=1262968108&im=false" | sed 's/,//g')
EOUTPUT=$(echo 1,1,0,1041379200,18446744071500476416,REG,CDR,ORACLE,cdr,10.255.255.11 | sed 's/,//g')
#echo $RESULTS > /tmp/nagios_datalocation_results.txt
#echo $EOUTPUT > /tmp/nagios_datalocation_eouput.txt
#exit
if [[ "$RESULTS" != "$EOUTPUT" ]] ; then
echo "2"
exit 2
else
echo "0"
exit 0
fi
So basically, even though the contents of both $RESULTS and $EOUTPUT are the same, this shell script isn't recognizing that and is aborting with a 2. rather than a 0.