date +“%Y-%m-%d” in crontab

后端 未结 1 1900
耶瑟儿~
耶瑟儿~ 2020-12-22 00:07

If I put the following in crontab -e:

* * * * * date +\"%Y-%m-%d\" > /home/apps/temp/env.txt

there is no env.txt

相关标签:
1条回答
  • 2020-12-22 00:23

    You need to escape each one of the %:

    * * * * * date +"\%Y-\%m-\%d" > /home/apps/temp/env.txt
    

    Or even better, remove the quotes and leave like this:

    * * * * * date +\%Y-\%m-\%d > /home/apps/temp/env.txt
    
    0 讨论(0)
提交回复
热议问题