crontab: %-sign

Issues related to applications and software problems
Post Reply
r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

crontab: %-sign

Post by r_a_mueller » 2018/12/19 07:56:05

Hi all,
I wanted to print a table, generated with a cronjob. The date in this table should be printed as follows:

Code: Select all

19.12.2018 08:40:02
Because the %-sign in the crontab writes a new line, I escaped the % with \ within the date command:

Code: Select all

date +"\%d.\%m.\%Y \%T"
But the backslash will be printed, too, in contrast to all the information I found:

Code: Select all

\19.\12.\2018 \08:40:02
This is not what I want. How can I get rid of the backslash in the output?

Thank you, richard

r_a_mueller
Posts: 6
Joined: 2018/12/10 11:18:04

Re: crontab: %-sign

Post by r_a_mueller » 2018/12/19 17:18:33

Everything OK. It was my stupidness. The %'s are inside the script, which is called by cron, and not in the crontab itself. Sorry for this foolish question.

-richard

Post Reply