|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
|
#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! |
|
#3
|
|||
|
|||
|
RE: Add / Delete Shell Variables
Thna x4 ur reply!
Actually I want to write a script that does the mentioned functions.... |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Server Administration > Add / Delete Shell Variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|