How do I find .bash_profile and add to my shell

2019-02-17 00:02发布

问题:

I am trying to upgrade ruby using rvm. On the pragmatic site, it says:

The important part is to add the following line to the end of your shell's initialization file (.bash_profile):

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

How do I do this? Where is this initialization file? Please help

回答1:

It would be /home/$USER/.bash_profile, but would only be present if you're actually using bash as your shell. Other shells will use a 'dot file' with their name in them instead. You can view them with ls -ad $HOME/.*



回答2:

There are two initialization files .bash_profile & .bashrc, both present in user home directory.

.bash_profile is initialized when you login with userid. .bashrc is initialized when you are already logged in and want to open one more terminal.

If you want to add some settings in both the file then you can do following

if [ -f ~/.bashrc ];
 then
source ~/.bashrc
fi


标签: rvm