Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!uunet!mcsun!ukc!vision!chris From: chris@visionware.co.uk (Chris Davies) Newsgroups: comp.unix.questions Subject: Re: C shell question about foreach Keywords: csh, foreach Message-ID: <1991Jun6.085314.14683@visionware.co.uk> Date: 6 Jun 91 08:53:14 GMT References: <11842@hub.ucsb.edu> Reply-To: chris@visionware.co.uk (Chris Davies) Distribution: comp Organization: VisionWare Ltd., Leeds, UK Lines: 31 In article <11842@hub.ucsb.edu> 6600bori@ucsbuxa.ucsb.edu (Boris Burtin) writes: >I'm trying to write a csh script that will execute a series of commands for >every directory that exists in /home/pluto. This script works if I execute it >while I'm logged in, but it gives me a > syntax error at line 7: `(' unexpected >when I try to run it from crontab. I'd appreciate any help I can get! Here's Crontab assumes everything it gets given is sh script (not csh). Generally on SysV.3 or earlier (assuming even the existance of a C-shell) you will need to run your script from crontab explicitly with the C-shell, viz csh myscript where you've called your script "myscript". You don't need to do this when you execute the script while you're logged in, since the C-Shell recognises the # on the first line as assumes it's a C-Shell script. Purists might argue that scripts should not be written using the C-shell language, but rather sh (or perl!) should be preferred. If you're not using AT&T Unix SysV.3 (or so) then things may be a little different - you didn't say what sort of Unix you were using. Chris -- VISIONWARE LTD, 57 Cardigan Lane, LEEDS LS4 2LE, England Tel +44 532 788858. Fax +44 532 304676. Email chris@visionware.co.uk -------------- "VisionWare: The home of DOS/UNIX/X integration" -------------