Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I've been trying to determine if it is possible to specify a shell or shell variables and parameters for perl. The issue that I have is that there are specific environment variables and parameters that need to be set in a .csh environment (ex. PATH). When using the backticks like `myscript` it is instantiating a new shell and applying any environmental variables from the .cshrc which is overwriting the needed environmental variables.

The underlying reason for doing this is that there are several commands such as cp, cd, uname, etc that I need to use alternate versions while using an NFS mounted file system that cannot handle several special cases such as hard/soft links in a UNIX style fashion, and special code needs to be called to handle these kinds of issues. Unfortunately when trying to use `cp` in perl I am getting the wrong version since the PATH is coming from the newly instantiated csh and not from the enviroment that perl is running in.

I believe that the standard practice to get csh to do a 'fast' login is to use the -f switch and then it will avoid loading up the .cshrc and thus wouldn't overwrite the currently setup environment and variables.

Is there any variable or parameter in perl that can be set to tell it for example to use "csh -f" for the enviroment, or perhaps set it to "ksh" or "bash" for the shell? I've tried looking through all the docs, and while I believe system called through a multi parameter mode would avoid the shell (and probably do what I want) it only returns a status code of the program run and not the actual contents. Having to pipe the output to a file and then reading that in is perhaps a bit more complicated than the intended fix.

Thanks in advance for any hints or clues that may help me out here!


In reply to Specifying a shell for use with Backticks by gaspodethewonderdog

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (5)
    As of 2021-04-13 11:23 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?