Public bug reported:

The manual for crontab(5) shows various examples of using the date command as 
such:
$(date +%u)

This contradicts the note specifying that any % sign needs to be escaped

Entering something like that as a command for execution fails to
interpret anything past the % sign.

so, for example:
* * * * * echo $(date +%Y)
fails with
/bin/sh: 1: Syntax error: end of file unexpected (expecting ")")

The syslog shows this
 CRON[10104]: (root) CMD (echo $(date +)

Simply escaping the % resolves it, so in this example, the manual should
be updated so that each 'date' example looks as

$(date +\%u) - or whatever the format character example is.
My example cron from above executes as expected as
* * * * * echo $(date +\%Y)

which send me an email simply with "2013"

** Affects: cron (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "cron-man.patch"
   
https://bugs.launchpad.net/bugs/1110147/+attachment/3507174/+files/cron-man.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1110147

Title:
  Error in manual

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cron/+bug/1110147/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to