LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How do I get Bash to reread the bashrc file? (https://www.linuxquestions.org/questions/linux-software-2/how-do-i-get-bash-to-reread-the-bashrc-file-252405/)

will103 11-08-2004 09:03 AM

How do I get Bash to reread the bashrc file?
 
Hi, I have a quick question regarding the Bash shell and bashrc file. If I make some changes to my bashrc file, is there a way of making Bash reread the file without quiting and restarting my terminal emulator?

Thanks in advance

will103

paicolman 11-08-2004 09:11 AM

. .bashrc
(not the space between the two dots) It reads it and applies the changes to the active shell.

paicolman 11-08-2004 09:11 AM

not "not", "note"

will103 11-08-2004 02:46 PM

Tried that but no luck. If I add an alias to my .bashrc then run the command

. .bashrc

It doesn't recognise the alias.

"source ~/.bashrc" didn't work either.

Thanks

will103

UsualTuxpect 11-08-2004 02:58 PM

Open a new terminal session...

paicolman 11-09-2004 12:29 AM

...no more ideas here. Have you checked if it excecutes the .bashrc, say via an echo "whatever" somwhere in the script?

cryptwizard 11-09-2004 12:42 AM

i'm pretty sure "source ~/.bashrc" will work.
but it appears a problem. try reinstalling bash.

Seagull 11-09-2004 02:49 AM

. ~/.bashrc works for me. Give that a try.

jschiwal 11-09-2004 07:16 AM

Or you could run /bin/bash. You will be running a new shell. (a subshell actually)

Since alias definitions need only be defined once, .bash_login or .profile would be better places to put them.

Some distros source a ~/.aliases file from /etc/profile if it exists.

cyberliche 11-09-2004 04:36 PM

Depending on the term emulator your using .bashrc might not be the file your emulator looks to for user preferences. For instance I'm using gnome (gnome-terminal) and I couldn't figure out why putting stuff in my .bashrc didn't change anything (before this I was strictly CLI only). One of my friends suggested that I make a softlink to point .bash_profile -> .bashrc .

If source .bashrc and . .bashrc don't work I'd try creating a softlink from .bash_profile -> .bashrc .

will103 11-10-2004 01:27 PM

Thanks for all of your suggestions. I will give them a try.

Cheers

will103

vgrozev 04-13-2011 07:27 AM

I know that this is an old thread, but wanted to clarify the fact that:
. .bashrc works correctly if executed from the directory where bashrc resides (home), if you are not in that directory then you need:
. ~/.bashrc , which is essentially the same, but with a path to the home directory provided.

Thanks,
Vlad


All times are GMT -5. The time now is 11:52 AM.