Setting environment variables in RHEL4
I have looked through numerous posts but can't seem to find what I'm looking for. I'm trying to set environment variables in RHEL 4 but it doesn't seem to be working. I need a new variable called ANT_HOME to point to /usr/ant. I opened up a terminal and typed $ANT_HOME=/usr/ant. I then typed $env but my new variable wasn't listed. I also need to know how to edit the PATH variable. I have a few lines to add to it and I'm not sure how to edit an existing variable.
|
the correct syntax is
Code:
ANT_HOME=/usr/ant Code:
export ANT_HOME Edit your .bashrc file if you want to set the variable every time you launch a terminal. In the same manner you can edit your PATH variable: just separate different paths with ":" |
to make a variable in bash it is simply <variableName>=<value> to call the variable you use the $<variableName>
|
I am new to Linux .I am 70 years old and interested in linux's operating systems.
1.Which is the best linux operating system. 2. Which is the simplest to use. |
Quote:
|
Thanks guys. So if I do
PATH=%ANT_HOME%\bin that won't overwrite anything already in PATH? |
no, the correct syntax is
Code:
PATH=$PATH:$ANT_HOME/bin |
That worked. Thanks!
Also, I don't have a .bashrc file on my RHEL4 machine. However I have Ubuntu up and running and I found it on there. Why wouldn't RHEL4 have the file? So I have my variables in, is there another way to save them so they will always be routed? |
look for the .bash_profile file in your home or the generic /etc/profile file (for all users)
|
I see. I found /etc/bashrc. It is the same thing as the .bashrc in Ubuntu. Do I simply write the same things in here that I did in the terminal? If so, where exactly do I put them?
|
The configuration files you find in /etc are the basis for new users.
When a new user is created this are copied and renamed in his home. You have to find these files in your home (I hope you are not working as root). Anyway the syntax is the same as the original ones. |
The bashrc file said to put environment stuff in /etc/profile. I'm there now but am still not sure where to write the paths.
|
I see... Thanks
|
All times are GMT -5. The time now is 07:29 AM. |