luckytaxi luckytaxi - 3 months ago 15
Bash Question

Check to see if today is a certain date

I want to check if the day is Sunday, but for some reason I can't get it to work.

[[ "date '+%a'" == "Sun" ]] && echo "Today is Sunday"

Answer Source

Use $(...) to execute a command and return the output as a string:

[[ $(date '+%a') == "Sun" ]]