I'm new to bash scripting and i want to compare two strings, here's my code
#!/bin/bash
EXITCODE=0;
COMPARE_RESULT=sudo php /home/xxx/compareMD5.php
echo $COMPARE_RESULT
if [ "$COMPARE_RESULT"="ok" ]; then
echo error log is not changed
EXITCODE=10
elif [ "${COMPARE_RESULT}"="mysqlerror" ]; then
echo mysqlerror
EXITCODE=11
elif [ "${COMPARE_RESULT}"="apacheerror" ]; then
echo apacheerror
EXITCODE=12
fi
exit $EXITCODE
the php file will return either ok, mysqlerror or apacheerror and when i run the script, the COMPARE_RESULT prints "mysqlerror" but still goes in to if first if condition and print "error log is not changed", anyone know why? thanks