Linux Ubuntu Set Environmental Variable Permanently

1) create a shell script and put the shell script at /etc/profile.d

2) edit the shell script and put export VARIABLE_NAME=VALUE

3) log out and login again or restart your PC.

Example:-

1) I create a file called localvariables.sh

2) inside the file

export ANT_HOME=/usr/share/ant

export PATH=${PATH}:${ANT_HOME}/bin

3) put the file in /etc/profile.d

4) logout then login again or restart. test the variable by doing

$ echo $ANT_HOME

outcome :

/usr/local/bin/ant

Source http://devoneblog.radmik.com/?tag=linux-ubuntu-set-enviromental-variable-permanently

No comments: