On Friday 09 March 2007 13:37, Greg Ercolano wrote:
>
> # LOAD A CSH SCRIPT'S ENVIRONMENT SETTINGS INTO PERL ENVIRONMENT
> # $1 = csh script to be 'sourced'
> # Returns: $ENV{} modified as per csh script's settings.
> #
> sub LoadEnvFromCsh($)
> {
> my ($rcfile) = $_[0];
> my $vars = `csh -fc 'source $rcfile; printenv'`;
> foreach ( split(/\n/, $vars) )
> { if ( /(^[^=]*)=(.*)/ ) { $ENV{$1} = $2; } }
> }
>
There are certain environment variables you may want to avoid setting. These
are the ones I have gleamed over the years.
TERM, DISPLAY, _, SHELLOPTS, BASH_VERSINFO, EUID, GROUPS, PPID, UID
There are several ways you could modify Gregs routine above to handle this.
I'll leave that as an exercise to the reader. As Greg said, you really must
know what you are doing and you must have a really tight reign on the users
environment. If you do this I would recommend printing the users environment
as the last step before running your render command so you will have a copy
in the rush log file. This is very useful for looking at what could be
causing a failure for a user.
|