Since the %
has special meaning to cron, how do I use it as part of a command?
I found this page http://www.hcidata.info/crontab.htm, which mentions piping echo
and sed
to escape the %
and then remove the extra \
, but in my case, the command is date
, which doesn't accept parameters through STDIN, so this doesn't work:
echo '+\%Y' | sed -e 's|\\||g' | date
I'm thinking I can create a special date script that will output the date in the format I want, and call that instead, but I'm still wondering if it's possible to do it directly in the cron command.
Thanks!