[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cron sh ?



On Mon, Mar 17, 2003 at 01:04:35PM -0600, Lance Hoffmeyer wrote:
> I have a cron script and a line:
> 
> ... wget ... -O ~/Base$(data +%H%M).gif
                                ^ ^

> and I get the error
> 
> /bin/sh: -c: line1: unexpected EOF while looking for matching `)'
> /bin/sh: -c: line2: syntax error: unexpected end of file
> 
> I am guessing that because I am running bash via cron that I am missing
> slashes or I need to enclose the command in quotes?

$ man 5 crontab
...
       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.
...

Change the %s to \%s and you should be set.

-- 
The freedoms that we enjoy presently are the most important victories of the
White Hats over the past several millennia, and it is vitally important that
we don't give them up now, only because we are frightened.
  - Eolake Stobblehouse (http://stobblehouse.com/text/battle.html)



Reply to: