Regarding Env variables

Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2007
Posts: 35
Reputation: RohitSahni is an unknown quantity at this point 
Solved Threads: 0
RohitSahni RohitSahni is offline Offline
Light Poster

Regarding Env variables

 
0
  #1
Nov 27th, 2007
Hi All,

My query is related to assinging a variable with value which is there in the env.

Suppose from my c++ code i am doing putenv("A=abc"), now wat i want to do is to get this value of A in my shell script and assisng this "abc" to my shell variable, any idea how can i achieve this.

Thansk in advance.
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 399
Reputation: eggi will become famous soon enough eggi will become famous soon enough 
Solved Threads: 47
eggi eggi is offline Offline
Posting Whiz

Re: Regarding Env variables

 
0
  #2
Nov 28th, 2007
Assuming you're running the c++ code from within a script, so that the ENV stays the same, you can just do

export SHELL=$A

if that's a misunderstanding, you can do this

export var=$A

Hopefully, I understood what you meant

, Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
The greatest viral marketing idea of all time, get your copy of this Free Report now!
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC