LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-24-2010, 06:26 AM   #1
kharnab
LQ Newbie
 
Registered: Aug 2010
Posts: 1

Rep: Reputation: 0
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
 
Old 08-24-2010, 06:33 AM   #2
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 707

Rep: Reputation: 55
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.

Last edited by vinaytp; 08-24-2010 at 06:35 AM.
 
Old 08-24-2010, 07:03 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PATH set incorrectly and lost bash: vi command... how can I change .bashrc? Lindz Linux - Newbie 10 09-23-2009 05:01 AM
problem in set the $PATH and $CLASSPATH in my .bashrc htamayo Linux - Newbie 5 04-10-2009 06:43 AM
set up java_home path in /home/user/.bashrc but use path in /usr/lib/java vitalstrike82 Slackware 4 01-13-2009 11:25 PM
In which file do I have to set path in Fedora 8? shyan Linux - Newbie 3 12-12-2008 04:57 PM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 10:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration