Cron and percent sign

I write the crontab command in the file

длинная команда $(date +%Y%m%d%H%M%S) продолжение

When cron starts execution, it sees only this part of

длинная команда $(date +

Everything after + it doesn't see.

How can this be overcome?

Author: aleksandr barakin, 2017-05-24

1 answers

According to the documentation ($ man 5 crontab or online) the percent character % will be converted by the cron program to a newline character.

To avoid this, add a backslash character before each % character used:

... $(date +\%Y\%m\%d\%H\%M\%S) ...
 3
Author: aleksandr barakin, 2017-05-24 15:44:42