in reply to set environment for parent process

tilly wrote Get default login environment, which demonstrates how to set up the environment by a shell script and still get it into a parent process.

Replies are listed 'Best First'.
Re^2: set environment for parent process
by Ronnie (Scribe) on Apr 28, 2006 at 13:34 UTC
    I may be missing the point of your reply (don't know why I made that a may?!) but the shell scripts I'm converting call these 2 scripts then run more code but all of this is in just 1 script. As such this environment doesn't exist until generated by the script at run time. It's not CRON related but job specific. Am I still not so much missing the boat as drowning? Be gentle.......

    Ronnie

      You said:

      The problem is that the shell script runs 2 scripts to set up the required environment.

      tilly's snippet does just that - it runs some script and extracts the environment that script sets up. This approach is the only approach under unixish shells by which you can get at whatever environment a script sets up when being sourced. Even though your script is not being run by cron, I think your problem is the same and is solved by tilly's approach.

      You'd have to read the referenced node and attempt to understand it to get the point of course...

        What's humorous to me is that Ronnie actually participated in that thread back in 2004...



        --chargrill
        $,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}