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

I'm not too familiar with UNIX but I'm guessing that the line containing 'exec' is passing the contents of the .profile into the array emvlines which is then parsed in the foreach loop - (Our sites .profile standards, well don't exist, so we could have several commands on one line including export for example. What's puzzling me here is the variable declarations at the begining. Is the first parameter supplied the name of the .profile file? If so what is the purpose of @my_parms? Our .profile covers all 3 DB's we just type in the relevant name at the UNIX prompt and the appropriate environment is available. Have I misunderstood? Cheers, Ronnie

Replies are listed 'Best First'.
Re^3: Unix Aliases?
by ikegami (Patriarch) on Sep 07, 2004 at 16:51 UTC
    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.

      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