Cheatsheet: dynamic date value in shell scripts

using a variable – easier to read in scripts:
NOW=$(date +"%Y%m%d%H%M%S")
echo "bar" > "$NOW"foobar.txt

one-line, equivalent to above:
echo "bar" > $(date +"%Y%m%d%H%M%S")foobar.txt

alternate single-line format:
echo "bar" >> $(date "+myfile%Y%m%d.txt")

man strftime to see formatting values

crontab example line with shell export and output to logfile

(export PATH=$PATH:/usr/local/bin; \
     /path/to/myscript.sh) >> /home/www/log/publish.log 2>&1