UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 25th, 2004, 11:06 AM
amine amine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 26 amine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Subject: Creating an environment variable on linux

My system is Linux Fedora Core 1. The shell scripts used here are bash ones (not sh, nore csh). I want to create an new environment variable. It is easy: there is a command!!

#export PATH=”/usr/local/ActiveTcl/bin:$PATH”

I tape on my console:
#echo $PATH
I got the expected result. BUT, when I close the console window, the value of the environment variable is to its initial value. In fact, that directory “/usr/local/ActiveTcl/bin” is no longer here, as if I never tape the command #export PATH=”/usr/local/ActiveTcl/bin:$PATH”.
So, I have to tape it many times I need it.

Can use the .bash_profile file to create an new environment variable???
Where can declare new environment variables?

Please help me...

Reply With Quote
  #2  
Old October 26th, 2004, 07:26 AM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,440 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 50 m 56 sec
Reputation Power: 797
Yes, you can use .bash_profile to add new things to your environment.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month

Reply With Quote
  #3  
Old October 26th, 2004, 10:10 AM
amine amine is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 26 amine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I did what you told me, but the result is still the same.

I did what you told me, but the result is still the same. I wrote in .bash_profile file these lines:
PATH=$PATH:/usr/local/ActiveTcl/bin
Export PATH

Can you tell me how to create a new one? Forget now the PATH environment variable!! Let’s say TRIAL_VAR. I wrote in .bash_profile file these lines:
TRIAL_VAR =/usr/local/ActiveTcl/bin
Export TRIAL_VAR

Then, in the console I tape:
# echo $TRIAL_VAR
I got no thing… This means that TRIAL_VAR isn’t declared yet.
To fix the ideas, the USER environment variable is not declared in .bash_profile file. Nevertheless, when I tape:
# echo $USER
I got “root”.

CONCLUSION, variable declarations should not be done in .bash_profile file!!!!
Where? I don’t know…
Please help me…

Reply With Quote
  #4  
Old October 26th, 2004, 12:17 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,440 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 50 m 56 sec
Reputation Power: 797
Use 'export' instead of 'Export' and it should work.
Code:
TRIAL_PATH=/usr/local/ActiveTcl/bin
export TRIAL_PATH

Testing it...
Code:
[mb@klinger mb]$ echo $TRIAL_PATH
/usr/local/ActiveTcl/bin

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Subject: Creating an environment variable on linux


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway