← Back to team overview

sslug-teknik team mailing list archive

Re: Crontab - første mandag i måneden

 

Jesper Honig Spring <sslug@xxxxxxxxxxxxxxx> writes:

>> [ `date +%a` == "Fri" ] && echo "flaf"

> if [ `date \+\%u` -eq 2 ]; then echo "hello world"; fi

Det er helt præcis %-tegnet der er problemet. 

crontab(5) siger:

   The ``sixth'' field (the rest of the line) specifies 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 cronfile.  Percent-signs (%) in the
   command, unless escaped with backslash (\), will be changed into
   newline characters, and all data after the first % will be sent to
   the command as standard input.


-- 
 Peter Makholm     |   First you fall in love with Antarctica, and then it
 peter@xxxxxxxxxxx |                                     breaks your heart
 http://hacking.dk |                                         -- Antarctica


References