I have written a simple if-else statement and am calling it from cronjob.
cronscript.sh
#!/bin/sh
# Author : TEST USER
# Script follows here:
VAR1="-h"
VAR2="-h"
if [[ "$VAR1" == "$VAR2" ]]; then
echo "Strings are equal."
else
echo "Strings are not equal."
fi
I'm always getting output as
Strings are not equal. Even though both strings are same why it is executing ELSE block?
cronjob command
34 18 05 * * /var/www/html/cronscript.sh > /var/www/html/testcron.txt
cronjob is executing properly and output is stored in testcron.txt file.
dashas /bin/sh?