Do you mean if .bash_profile exists, .bashrc will be ignored?

Thanks.

On Wed, Jan 12, 2022 at 8:07 PM Will Mengarini <sel...@eskimo.com> wrote:

> * Yamada??? <yamoer...@gmail.com> [22-01/12=We 19:49 +0800]:
> > I have a .bashrc file in my home dir, whose content is shown as follows.
> > But every time I log into the system, I have to source this file by hand.
> >
> > $ which scala
> > /usr/bin/scala
> >
> > $ cat .bashrc
> > #THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
> > export SDKMAN_DIR="$HOME/.sdkman"
> > [[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source \
> >   "$HOME/.sdkman/bin/sdkman-init.sh"
> >
> > $ . .bashrc
> > $ which scala
> > /home/xxx/.sdkman/candidates/scala/current/bin/scala
> >
> > How can I make it take effect automatically after I login the system?
>
> Check whether you have either ~/.bash_profile or ~/.profile.
>
> If ~/.bash_profile, the line
>   . ~/.bashrc
> will suffice.
>
> If ~/.profile, use
>   # if running bash
>   if [ -n "$BASH_VERSION" ]; then
>       # include .bashrc if it exists
>       if [ -f ~/.bashrc ]; then
>           . ~/.bashrc
>       fi
>   fi
> in case you someday want to try other shells.
>

Reply via email to