I'm new in bash scripting. I need to run the job every Tuesday if the day of the month is odd. I need something like this to check conditions: [$(date '+%d') is odd ] && ...job...
But I cannot find how to check if the day is odd (
Thanks for helping
if expr $(date +%d) % 2 > /dev/null; then
echo the day is odd
else
echo the day is even
fi
Or, if you want to be slightly less old-fashioned:
if (( $(date +%d) % 2 )); then echo odd; else echo even; fi