how to read unix profile variable into Perl

Reply

Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

how to read unix profile variable into Perl

 
0
  #1
Feb 26th, 2007
Hello I was wondering if there is a way to read a unix profile'd variable while inside my PERL code?

I'm trying to do something like this.

[code]
system( " execute some code >> $UNIXVAR\log");
also tried
system( " execute some code >> '$UNIXVAR\log'");
[\code]
I think though that the way I'm executing my application that I'm losing my profile's exported varibles.

I'm executing my app like this
./perlapp.pl
This is on an AIX Unix environment if this helps anyone.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,357
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: how to read unix profile variable into Perl

 
0
  #2
Feb 26th, 2007
  1. $ENV{UNIXVAR}
Last edited by masijade; Feb 26th, 2007 at 10:22 am. Reason: formatting
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

 
0
  #3
Feb 26th, 2007
Thanks for the quick reply, but that's not quite what I need.
I wasn't quite clear enough.
So for example say I export a path to a variable name then my perl script I want to access that path that is stored in the variable is there a way to access that?

From what I see from the $ENV variable options it holds a lot of information the system and unix environment but I do not see any profile/user variables in the list.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 6
Reputation: mandible is an unknown quantity at this point 
Solved Threads: 0
mandible mandible is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

 
0
  #4
Feb 26th, 2007
thanks for the help I didn't notice those were braces around the variable this is exactly what I needed
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: subii P is an unknown quantity at this point 
Solved Threads: 0
subii P subii P is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

 
0
  #5
Jul 30th, 2009
Hello,

I am facing the same probelm, and i am not clear with the solution.
I wanted to read a unix PATH variable into perl script.

$path_var=`$PATH`;

Can u help me in doing this.


Thanks in advance,
Subii
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,357
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: how to read unix profile variable into Perl

 
0
  #6
Jul 30th, 2009
  1. $ENV{PATH}
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 3
Reputation: subii P is an unknown quantity at this point 
Solved Threads: 0
subii P subii P is offline Offline
Newbie Poster

Re: how to read unix profile variable into Perl

 
0
  #7
Jul 30th, 2009
Thanks a lot... was trying with $ENV{$PATH}.....
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC