in reply to Re^2: Unix Aliases?
in thread Unix Aliases?

I'm guessing that the line containing 'exec' is passing the contents of the .profile into the array emvlines

Not quite. ksh is launched. First, ksh is told to executed .profile. It's assumed here that .profile is a valid (ksh) shell script with no nasty side effects. Once .profile finishes executed, ksh is told to execute "env", which returns something akin to the following:

BLOCKSIZE=K CC=cc CFLAGS=-O2 -mcpu=pentiumpro -pipe ... TEST=... LIVE=... TEACHING=... ...

That list is assigned to @envlines, and then parsed in the foreach loop.

Replies are listed 'Best First'.
Re^4: Unix Aliases?
by Ronnie (Scribe) on Sep 08, 2004 at 08:53 UTC
    I understand this now except for the use of the @my_parms variable. It doesn't appear to be used for anything. I thought it may be a way of passing extra environmental variables into this sub. I tried it and though it didn't fail there was no sign of my test variable anywhere. What IS the purpose of this variable? Cheers, Ronnie
      Well in fact our "my_env" is much more complicated and also accepts parameters to change it's behaviour. If your "my_env" does not take parameters just remove it completely. Actually I will remove it from my post above to make it more straight forward.

      pelagic
        Thanks for the information. There is one thing I should mention in case you are unaware of this; I've tested the sub and it works fine except for certain things. In our .profile we have a variable called TWO_TASK and it's set to isw_live, getenv ignores this line and doesn't set up the appropriate environmental variable. Things like PS1 & PS2 are also ignored. This may be intentional but as I can't find any documentation for env I thought I'd let you know. ( I also stuck in a couple of rogue variables fred=flintstone & barney=rubble and they were not picked up either.) Cheers,Ronnie