Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

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 Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 8th, 2003, 06:33 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Add / Delete Shell Variables

Hi, am new here

I am writing a basic shell script and need to add/delete/modify shell variables and environment variables.... how can i do so?

I know how to see all the shell variables - set command and how to see environment variables - env command but i couldnt figure out how to

Add/remove or modify shell/environment variables.

Thanx in Advance
~gaurav

Reply With Quote
  #2  
Old October 8th, 2003, 06:52 AM
coderboi coderboi is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 80 coderboi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Add / Delete Shell Variables

Hi

Somewhere in your home directory, you will have a .login or a .profile file - have a look for it using
Code:
ls -a


Note - it should only be called .login if your shell isn't bash or sh

It could also be a variation of .profile - on my system it's called .bash_profile

You can change / add environment variables here, but you'll need to logout and log back in again to activate them.

For example, say you wanted to set a variable called MYDIR with the value /home/user1/files/backup and also add that directory to the PATH variable, you could do it by adding the following lines to the .profile file:

Code:
MYDIR=/home/user1/files/backup
PATH $MYDIR:$PATH

export MYDIR PATH


Once you've made these changes, save the file, and then logout and login again and use 'set' to see whether the new environment variables have been assigned.

Good luck!

Reply With Quote
  #3  
Old October 9th, 2003, 05:28 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: Add / Delete Shell Variables

Thna x4 ur reply!
Actually I want to write a script that does the mentioned functions....

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > Add / Delete Shell Variables


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 4 hosted by Hostway