LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   set path for different software in the bashrc file (https://www.linuxquestions.org/questions/linux-newbie-8/set-path-for-different-software-in-the-bashrc-file-828175/)

kharnab 08-24-2010 06:26 AM

set path for different software in the bashrc file
 
Hello all,
I am a begginner in linux using redhat. I have installed a software and set the variables in the .bashrc file to avoid setting them everytime I would like to run te software. Now I have installed a new software and would like to do the same thing in the .bashrc file. How can I add the path to the new software directory without affecting the first software path.
Regards

vinaytp 08-24-2010 06:33 AM

kharnab,

Please paste whatever you have tried so far here.

If you want to set another variable, do the same thing which you did to set the variable before.

Code:

VAR="/new/path"
export $VAR

If you want to append path then append it in your ~/.bash_profile
Code:

PATH=$PATH:$HOME/bin:/sbin/
Path in bold is appended new path.

catkin 08-24-2010 07:03 AM

The usual way to achieve what you want to do is the /etc/profile.d system. Each software that needs environmental variables set installs a *.sh script in that directory. When bash starts up a login shell it runs /etc/profile and /etc/profile runs (sources) all the /etc/profile.d/*.sh scripts. This has the advantage of modularising the configuration scripts so that /etc/profile itself does not need to be changed each time a new software is installed, upgraded or removed.

If you want to set the software environmental variables for one user only, rather than globally, you could implement something like the /etc/profile.d system in the home directory, with say a ~/.bashrc.d directory.


All times are GMT -5. The time now is 07:04 PM.