Setting Environment variable in Linux
March 5, 2009 at 11:10 AM | Posted in Linux | 2 CommentsThe following setting is for FC8 Linux. The file name or path may change for different flavor of Linux
For system wide effect , edit /etc/bashrc file and for particular user edit file home/<username>/.bash_profile and add your environment variable. For example, adding JAVA_HOME variable
#export JAVA_HOME=/usr/bin
Then save the file and run it using source command.
#source /etc/bashrc or source /home//.bash_profile
You can test it by
echo $<your_variable_name>
2 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a Reply
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.
Adding few things here -
1. To set environment variable in csh use setenv and for bash, use export. For ex -
setenv JAVA_HOME “/usr/bin”
export JAVA_HOME=”/usr/bin”
2. When sourced the file, you may not see the changes in current shell. Open a new shell to changes to take place.
Comment by mukeshchauhan— March 6, 2009 #
Good one dear…waiting for more reply….
Comment by shabirimam— March 7, 2009 #