当前位置: 动力学知识库 > 问答 > 编程问答 >

bash - 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.]

网友答案:

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
[[email protected] ~]$ echo $BASHRC
yes
[[email protected] ~]$ echo $BASH_PROFILE

Notice we did not get yes with this last one.

Now with a login shell:

% bash --login
[[email protected] ~]$ echo $BASHRC
yes
[[email protected] ~]$ echo $BASH_PROFILE
yes

See paragraph INVOCATION from man bash.

分享给朋友:
您可能感兴趣的文章:
随机阅读: