LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   bash.bashrc updation in SLES11 SP1 (https://www.linuxquestions.org/questions/linux-newbie-8/bash-bashrc-updation-in-sles11-sp1-862044/)

ksp009 02-11-2011 07:43 AM

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

bigrigdriver 02-11-2011 08:04 AM

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.


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