On Ubuntu 10.04. This certain piece of code:
if [ $(date +%w) = 0 ]; then
# code to run if it's a Sunday
# code to run to do regular stuff on other days
works great when the script is run from command line, but never seems to run the "Sunday code" when triggered via cron - it always runs the "regular" code. I've tried many different things, such as putting the full path for the `date` command, as well as trying other options such as %u (7 for Sunday) and storing the output of `date +%w` to a variable first. Any idea what's going on? Thanks!