Re: Accessing Environment Variables within a strored proc.
Posted in 1998
On Wed, 1 Jul 1998, Viegas, John wrote: > We are on 7.21 on AIX 4.1.5. > When making a system call within stored procs, how do you access > environment variables (ie $HOME) that are set in your .profile? Mostly, you don't. That is, there's no easy way to get environment data from the outside the stored procedure into the stored procedure. It would be easier, but not easy, with IUS - aka IDS/UDO. And the environment handed to the program run by the 'system' call will not be the same as that of the user. If you specify the HOME directory to the program run by SYSTEM, you can use ". $HOME/.profile" in the script to make the environment available to the script: -- Shell Script run by SYSTEM: . $HOME/.profile do_whatever you want # eg: { date id -a env | sort } > /tmp/script.env -- SYSTEM call: LET cmd = "HOME=/home/" || USERNAME || " script"; SYSTEM cmd; -- End Of course, this assumes that your .profile doesn't do anything silly like ask questions... Yours, Jonathan Leffler (jleffler@informix.com) #include <witticism.h> Guardian of DBD::Informix -- see http://www.perl.com/CPAN