On 2025-10-09 23:54:22 +0200, Sylvain Saboua wrote:
> I have two crontab entries intended for backups:
> tar cf "/home/bkup/saboua.xyz.tar.$( date +%Y%m%d )"
> /var/www/htdocs/saboua.xyz/
> tar cf "/home/bkup/sylvain_dotfiles.tar.$( date+%Y%m%d )" -I
> /home/sylvain/.dotfiles
$ man 5 crontab | perl -00 -nle 'print if /Percent signs/'
The command field (the rest of the line) is the command to be run. The
entire command portion of the line, up to a newline or % character, will
be executed by /bin/sh or by the shell specified in the SHELL variable of
the crontab. Percent signs (`%') in the command, unless escaped with a
backslash (`\'), will be changed into newline characters, and all data
after the first `%' will be sent to the command as standard input.
Another idea is to put the code into a file (that can be tested, checked
into version control, etc) and then run that script from cron.