Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set profile environment

Status
Not open for further replies.

naru21

Technical User
May 24, 2002
13
US
Hi,
how does one execute the .profile environment in perl
when i use

system (". /usr/local/grod/.profile");

it doesnt set the environment when i ran the script from crontab.
could anyone tell me why this is happening.how i can fix the problem.
any help is appreciated.

 
Well.... It *does* set the environment, but only in the shell it uses in the system() command; that shell then disappears without trace once the command is finished.

You can change the environment variables within Perl by assigning to the %ENV hash, like this:

$ENV{'PATH'} = '/another/nice/path/youve/got/me/into/;

To do what you want you will have to read in the .profile script, look for the variable assignements (somehow... remember that there may well be 'if' statements in there that will muck you about) and then set the %ENV hash from these values... Mike
________________________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top