Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-11-2011, 07:43 AM   #1
LQ Newbie
Registered: Dec 2010
Posts: 19

Rep: Reputation: 0
bash.bashrc updation in SLES11 SP1


I have installed SLES11 SP1 on my machine.Then I upadted the PATH in /etc/bash.bashrc by adding the new PATH at the end of this file. I have done this by using a script.

The script contents listed below:
# Setting the Path
if test `grep -c "export PATH=/opt/usr/lib64/mpi/gcc/openmpi/bin:/opt/sbin:/opt/usr/sbin:/opt/usr/local/sbin:/opt/root/bin:/opt/usr/local/bin:/opt/usr/bin:/opt/bin:/opt/usr/bin/X11:/opt/usr/X11R6/bin:/opt/usr/games:/opt/usr/lib/mit/bin:/opt/usr/lib/mit/sbin" /etc/bash.bashrc` -eq 0;\
then echo "export PATH=/opt/usr/lib64/mpi/gcc/openmpi/bin:/opt/sbin:/opt/usr/sbin:/opt/usr/local/sbin:/opt/root/bin:/opt/usr/local/bin:/opt/usr/bin:/opt/bin:/opt/usr/bin/X11:/opt/usr/X11R6/bin:/opt/usr/games:/opt/usr/lib/mit/bin:/opt/usr/lib/mit/sbin:$PATH" >> /etc/bash.bashrc
echo "path exported"

source /etc/bash.bashrc
echo "bashrc updated!!"
echo $PATH

It executes successfully. echo $PATH in the script list the full path correctly. But after executing the script, I given "echo $PATH" in the same terminal(The terminal on which the script is executed), PATH didn't get printed(Only the old path got printed). But in all other terminals it got printed correctly.
What is the problem with that terminal?

Old 02-11-2011, 08:04 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,891

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
You have the system config file /etc/bash.bashrc, and the users ~/.bashrc. When you change the /etc/bash.bashrc, you do not change the ~/.bashrc which applies the users own preferences to the bash session when the terminal is opened. Sourcing /etc/bash.bashrc doesn't change the users session.

When the script has run, the user has to also run "source /etc/bash.bashrc" from his terminal for changes to take effect.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
bash not reading bashrc exvor Linux From Scratch 2 11-30-2009 12:04 AM
[SOLVED] .bashrc cant get rid of (bash 3.2#) hunnykhan3 Linux - General 11 08-24-2009 10:39 AM
/etc/bash.bashrc sulekha Ubuntu 1 11-05-2008 06:58 AM
how to execute bash-script from .bashrc mrsvan Linux - General 3 07-21-2008 07:26 AM
/etc/profile vs. /etc/bash.bashrc jbrashear Debian 3 03-11-2004 03:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:35 AM.

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