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

In reply to Environment Variable Setting by austinj

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.