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"
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"
Use $(...)
to execute a command and return the output as a string:
[[ $(date '+%a') == "Sun" ]]
You can use the date +%u to get the day number of the week... 1 - 7 with Monday being 1 that way you should not have an issue with non-english locales