syntax of cron commands

syntax of cron commands

Post by Otavio Ex » Wed, 02 Jun 1999 04:00:00



hello all,

I have a mailbox that I'd like to keep in separate 'per month' files; so
I have this line in my personal crontab:

1 0 1 * * mv mailbox mailbox.$(date "+%Y%m" --date "last month")

looks like there is a quote-related problem going on! I have tried with
single and double quotes but I always get an error message by mail like
that:

Quote:> X-Cron-Env: <SHELL=/bin/sh>
> X-Cron-Env: <HOME=/home/username>
> X-Cron-Env: <PATH=/usr/local/bin:/usr/bin:/bin:.>
> X-Cron-Env: <LOGNAME=username>

> /bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
> /bin/sh: -c: line 2: syntax error: unexpected end of file

any clues?

TIA!

--

 
 
 

syntax of cron commands

Post by L J Bay » Thu, 03 Jun 1999 04:00:00



>hello all,

>I have a mailbox that I'd like to keep in separate 'per month' files; so
>I have this line in my personal crontab:

>1 0 1 * * mv mailbox mailbox.$(date "+%Y%m" --date "last month")

>looks like there is a quote-related problem going on! I have tried with
>single and double quotes but I always get an error message by mail like
>that:

>> X-Cron-Env: <SHELL=/bin/sh>
>> X-Cron-Env: <HOME=/home/username>
>> X-Cron-Env: <PATH=/usr/local/bin:/usr/bin:/bin:.>
>> X-Cron-Env: <LOGNAME=username>

>> /bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
>> /bin/sh: -c: line 2: syntax error: unexpected end of file

>any clues?

Maybe? The $(...) syntax requires ksh or posix_sh; bash won't do it.
Cron always uses /bin/sh which is probably bash on your system.
Try `...` instead.

 
 
 

syntax of cron commands

Post by Otavio Ex » Thu, 03 Jun 1999 04:00:00



> >I have a mailbox that I'd like to keep in separate 'per month' files; so
> >I have this line in my personal crontab:

> >1 0 1 * * mv mailbox mailbox.$(date "+%Y%m" --date "last month")

> >looks like there is a quote-related problem going on! I have tried with
> >single and double quotes but I always get an error message by mail like
> >that:

> >> X-Cron-Env: <SHELL=/bin/sh>
> >> X-Cron-Env: <HOME=/home/username>
> >> X-Cron-Env: <PATH=/usr/local/bin:/usr/bin:/bin:.>
> >> X-Cron-Env: <LOGNAME=username>

> >> /bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
> >> /bin/sh: -c: line 2: syntax error: unexpected end of file


Quote:

> Maybe? The $(...) syntax requires ksh or posix_sh; bash won't do it.
> Cron always uses /bin/sh which is probably bash on your system.  Try
> `...` instead.

thanks, LJ, you are probably right! unfortunately I'm so lazy that I'll
have to wait until next month to make sure you are really right :-))

since the first time I tried to nest backquotes :-( I started to use
only $(..) in my scripts..  btw: anyone knows of a way to (sort of) nest
backquotes?

--

 
 
 

syntax of cron commands

Post by Donovan Rebbec » Thu, 03 Jun 1999 04:00:00



Quote:>hello all,

>any clues?

I don't have any clues, but I'd have a guess that quoting your quotes
(eg \" instead of " ) might fix the problem.
Then again it might not.

--

Buying computer parts ? How do you know which vendors to trust ?
http://www.resellerratings.com
Impartial and accurate. Straight from the buyers mouth.
( disclaimer: i'm not affiliated with resellerratings.com )

 
 
 

syntax of cron commands

Post by Donovan Rebbec » Thu, 03 Jun 1999 04:00:00




>Maybe? The $(...) syntax requires ksh or posix_sh; bash won't do it.

nope. bash can do it

Quote:>Cron always uses /bin/sh which is probably bash on your system.
>Try `...` instead.

/bin/sh emulates the posix shell, so on linux , $(  ) should stil work.
 
 
 

syntax of cron commands

Post by Jim Cochra » Sun, 06 Jun 1999 04:00:00


After a bit of experimentation, and checking the crontab(5) manual, I
discovered that % characters need to be escaped with a backslash -
otherwise cron translates them into newlines.  So if you change the entry
to:

1 0 1 * * mv /tmp/mailbox /tmp/mailbox.$(date +\%Y\%m --date "last month")

it should work - it worked for me.  (Oddly, when I left +\%Y\%m in quotes,
the backslashes showed up as part of the file name.)



>hello all,

>I have a mailbox that I'd like to keep in separate 'per month' files; so
>I have this line in my personal crontab:

>1 0 1 * * mv mailbox mailbox.$(date "+%Y%m" --date "last month")

>looks like there is a quote-related problem going on! I have tried with
>single and double quotes but I always get an error message by mail like
>that:

>> X-Cron-Env: <SHELL=/bin/sh>
>> X-Cron-Env: <HOME=/home/username>
>> X-Cron-Env: <PATH=/usr/local/bin:/usr/bin:/bin:.>
>> X-Cron-Env: <LOGNAME=username>

>> /bin/sh: -c: line 1: unexpected EOF while looking for matching `"'
>> /bin/sh: -c: line 2: syntax error: unexpected end of file

>any clues?

>TIA!

>--


--
Jim Cochrane

 
 
 

1. Translating ARP commands from linux syntax to dos command prompt

Hi all!

Can someone please help me translating following ARP commands to dos,
so I can run then from command prompt in win98.

IPADDRESS=212.186.161.144
MODEMMAC=00:00:ca:11:fa:ee
DEVICE=eth1
FGATEWAY=10.10.10.0

arp -s $FGATEWAY $MODEMMAC -i $DEVICE
arp -s $IPADDRESS $MODEMMAC -i $DEVICE

route add -net $FGATEWAY netmask 255.255.255.0 dev $DEVICE
route add default gw $FGATEWAY dev $DEVICE

route del default gw $FGATEWAY dev $DEVICE
route del -net $FGATEWAY netmask 255.255.255.0 dev $DEVICE

Thanks a lot and greetings......Sam

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Question about alias in C shell

3. Syntax for apending a timestamp to a cron job log?

4. Help! configuring eth0 on my Bronze PowerBook G3 400

5. Syntax error in slocate.cron shell script

6. What is net-pf-4 and net-pf-5? DHCP?

7. cron syntax

8. poppasswd (changing password from network)

9. CRON - need to verify syntax

10. cron.deny and cron.allow files for CRON management

11. format command line syntax

12. paste command syntax question

13. dd command syntax question