LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 02-11-2011, 08:43 AM   #1
ksp009
LQ Newbie
 
Registered: Dec 2010
Posts: 19

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


HI

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
fi
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?


Thanks
 
Old 02-11-2011, 09:04 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Jessie 8.4
Posts: 5,873

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


Reply


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


All times are GMT -5. The time now is 02:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration