taufique
taufique

Reputation: 2751

Archlinux + MATE Terminal - `.bash_profile` is not being sourced

I am using Arch Linux with MATE as desktop environment. So terminal emulator is MATE Terminal. Recently I installed Jekyll with gem install jekyll. But when I ran jekyll -v it says bash: jekyll: command not found. So I tried to add path of Jekyll to PATH variable.

I ran PATH=$PATH/$HOME/.gem/ruby/2.2.0/bin and it worked perfectly. Now I can run jekyll commands. To add it permanently to PATH variable I edited the ~/.bash_profile file like following. It is not working after reboot. But source ~/.bash_profile works perfectly.

#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc

export PATH="${PATH}:/home/heisenberg/.gem/ruby/2.2.0/bin"

According to ArchWiki this is the proper way to concat something permanantly to PATH. But it isn't working. Can somebody figure me out where the wrong is?

[N. B. : Adding the same line in ~/.bashrc is doing okay.]

Upvotes: 0

Views: 2055

Answers (1)

galaux
galaux

Reputation: 382

Depending on the option it is given, bash can be run as an interactive shell or login shell. The default interactive shell mode does not read ~/.bash_profile. login shell bash do.

See:

First, some setup:

% cat ~/.bashrc
…
export BASHRC="yes"
…
% cat ~/.bash_profile
…
export BASH_PROFILE="yes"
…

Now run a regular (interactive) bash:

% bash
[galaux@magenta ~]$ echo $BASHRC
yes
[galaux@magenta ~]$ echo $BASH_PROFILE

Notice we did not get yes with this last one.

Now with a login shell:

% bash --login
[galaux@magenta ~]$ echo $BASHRC
yes
[galaux@magenta ~]$ echo $BASH_PROFILE
yes

See paragraph INVOCATION from man bash.

Upvotes: 0

Related Questions