luckytaxi luckytaxi - 10 months ago 45
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" ]]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download