My ultimate goal would be to write a script in perl that accomplishes the same thing the following csh code does. I tried to simply source the csh code (located in the file sge_sigma.csh) but have since learned that this creates a child process and as such environment variables are not passed upstream.
SO - I have been unsucessful in converting the following code from csh to perl.
#! /bin/csh
setenv SGE_ROOT /appl/lsf/grid_bins
set ARCH = `$SGE_ROOT/util/arch`
set DEFAULTMANPATH = `$SGE_ROOT/util/arch -m`
set MANTYPE = `$SGE_ROOT/util/arch -mt`
setenv SGE_CELL default
unsetenv SGE_QMASTER_PORT
unsetenv SGE_EXECD_PORT
# library path setting required only for architectures where RUNPATH i
+s not supported
if ( $?MANPATH == 1 ) then
setenv MANPATH $SGE_ROOT/${MANTYPE}:$MANPATH
else
setenv MANPATH $SGE_ROOT/${MANTYPE}:$DEFAULTMANPATH
endif
set path = ( $SGE_ROOT/bin/$ARCH $path )
switch ($ARCH)
case "sol*":
case "lx*":
breaksw
case "*":
set shlib_path_name = `$SGE_ROOT/util/arch -lib`
if ( `eval echo '$?'$shlib_path_name` ) then
set old_value = `eval echo '$'$shlib_path_name`
setenv $shlib_path_name "$SGE_ROOT/lib/$ARCH":"$old_value"
else
setenv $shlib_path_name $SGE_ROOT/lib/$ARCH
endif
unset shlib_path_name
endsw
unset ARCH DEFAULTMANPATH MANTYPE old_value
so far I have
#!/usr/local/bin/perl -w
use strict;
use Switch;
$ENV{SGE_ROOT} = "/appl/lsf/grid_bins";
my $ARCH = $ENV{SGE_ROOT} . "/util/arch";
my $DEFAULTMANPATH = $ENV{SGE_ROOT} . "/util/arch -m";
my $MANTYPE = $ENV{SGE_ROOT} . "/util/arch -mt";
$ENV{SGE_CELL} = "default";
delete($ENV{SGE_QMASTER_PORT});
delete($ENV{SGE_EXECD_PORT});
# NEED HELP HERE
if there is a cleaner way to somehow "source" the csh file or any other suggestions I'm open to whatever.
Thanks in advance for your help,
Austin