Help Cron: syntax error near unexpected token `do'

Moderator: crythias

Locked
tfraley
Znuny newbie
Posts: 1
Joined: 06 Sep 2011, 02:38
Znuny Version: 3.0.10
Real Name: Thomas
Company: life with tech

Help Cron: syntax error near unexpected token `do'

Post by tfraley »

Good day,

New user trying to set things up almost there got stumped on setting up cron job's

wondering if anyone could lend a hand.

I am trying to run the following command and receiving a syntax error.

support@support:/opt/otrs/var/cron$ sudo for foo in *.dist; do cp $foo `basename $foo .dist`; done
-bash: syntax error near unexpected token `do'

OTRS: Version 3.0.10
Ubuntu Server: 11.04

Thanks in advance.

FYI: basically running though this wiki article for the install
http://wiki.otrs.org/index.php?title=In ... %2810.4%29
Lorenzo_Marschall
Znuny advanced
Posts: 106
Joined: 13 May 2011, 14:47
Znuny Version: 2.4 / 3.x
Real Name: Lorenzo Marschall
Company: bmsoft information technologies GmbH
Location: Germany, Italy
Contact:

Re: Help Cron: syntax error near unexpected token `do'

Post by Lorenzo_Marschall »

don't mess up with your sudo.
OTRS + ITSM + PostgreSQL @ Debian
rpsu
Znuny newbie
Posts: 3
Joined: 24 Sep 2011, 14:08
Znuny Version: 3.0.10

Re: Help Cron: syntax error near unexpected token `do'

Post by rpsu »

You're trying to access a whole loop with sudo. Sudo is for swithcing to 'root' to execute something and you can not do it like that. Move 'sudo' right before actual command instead of your loop.

Code: Select all

for foo in *.dist ; do sudo cp $foo `basename $foo .dist`; done
Locked