Check to see if today is a certain date

shell

Solution

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

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

Problem

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" ```

Original source