C shell question about foreach
Chris Davies
chris at visionware.co.uk
Thu Jun 6 18:53:14 AEST 1991
In article <11842 at hub.ucsb.edu> 6600bori at 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 at visionware.co.uk
-------------- "VisionWare: The home of DOS/UNIX/X integration" -------------
More information about the Comp.unix.questions
mailing list