LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-13-2006, 05:05 AM   #1
Sundaram
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Rep: Reputation: 0
Lightbulb how to set the Environment variable from shell Scrit


I want to set the CPLUS_INCLUDE_PATH from my shell script file.

I tried the following way

export CPLUS_INCLUDE_PATH=.:/home/XXX/ABC/Include

I ran the script and I checked in the console

echo $CPLUS_INCLUDE_PATH it did not show the newly added include path.

anybody can help me.

Thanks in advance.
 
Old 10-13-2006, 05:23 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Hi,

If you set/export a (environment) variable inside a script, it will be lost after the script stops.
Exporting variables can only be exported from parent to child, not from child to parent.

You can source a file. I.e:
infile contains export FOO=/tmp

. infile will make FOO available in the current shell.

Hope this clears things up a bit.
 
Old 10-14-2006, 12:59 AM   #3
Sundaram
LQ Newbie
 
Registered: Oct 2006
Posts: 12

Original Poster
Rep: Reputation: 0
Thanks for your information.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set a value of environment variable? ukrainet Linux - Newbie 1 12-28-2004 05:33 AM
set environment variable Jongi Linux - Newbie 7 03-01-2004 05:34 AM
How to set a environment variable in rh? yenonn Linux - Newbie 11 02-21-2003 11:24 PM
how to set CC environment variable mr.moto General 2 12-18-2001 02:02 AM
how do you set the environment variable CC? mr.moto Linux - General 0 12-17-2001 10:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration