On Mon, Nov 12, 2001 at 09:44:57AM -0400, Glenn Thomson wrote: > I use a lot of C-shell and Perl scripts that are run by the crontab > command (under Linux). I have my path variables set up in my .cshrc > file. Thus when I run a perl script from the command line (c-shell) > I can inherit these path variables using the $ENV{C-SHELL ENV > VARIABLE NAME} construct.
Not sure what that last bit is, but I think you're asking about the environment when a cron job is run. The crontab(1) manual page mentions that the path is set to "/usr/bin" and that you need to set it, if you need something else. The same manual page says that the command is run by the Bourne shell (/bin/sh), so... Just put `PATH=/foo:/bar' in front of your command in the crontab to set the PATH variable. (That doesn't affect how cron finds the command you're running, so use a fully qualified path for that.) As a matter of fact put as many key=value things as you like in front of any command to set the environment for a command run by the Bourne shell. > The problem is that when I run a perl program as a cronjob, it is > not executing within a c-shell, and so the C-shell environment > variables are not inherited. How can I get around this problem? Environment variables are environment variables. I assume that the Perl script is expecting something special in its environment. Set it. The shell makes no difference except in the syntax for setting the environment variables. The Bourne shell and its derivatives will take key=value on the command line to set the environment for a command. > I have tried having a simple c-shell wrapper which is a run as a > cronjob, and this wrapper then calls my Perl program. But this does > not work (I don't understand why) - C-shell environment variables > are still not inherited by my Perl script. Well, maybe your .cshrc was never executed by this shell. Hard to tell with that description. Just set the environment before the command and all will be well. -- Garry Williams, Zvolve Systems, Inc., +1 770 551-4504 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]