I have read that we can determine the current date in Bash with the date command like follows:
NOW=$(date +"%Y-%m-%d")
In my crontab I append logs to files, and wanted to use this to put dates at the end of my file names, like follows:
cd /x/y/z/ && mycommand &>> /x/y/z/logs/mylog_$(date '+%Y%m%d').txt
However, this doesn't work as expected. I get the below error message, which I don't understand... I have no idea what it's referring to. I'm pretty new to using cron jobs.
/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file