0

我正在使用带有 MATE 的 Arch Linux 作为桌面环境。所以终端仿真器是 MATE 终端。最近gem install jekyll. 但是当我运行时jekyll -v它说bash: jekyll: command not found。所以我尝试将 Jekyll 的路径添加到 PATH 变量中。

我跑了PATH=$PATH/$HOME/.gem/ruby/2.2.0/bin,效果很好。现在我可以运行 jekyll 命令了。要将其永久添加到 PATH 变量中,我编辑了~/.bash_profile如下文件。重新启动后它不起作用。但 source ~/.bash_profile工作完美。

#
# ~/.bash_profile
#

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

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

根据ArchWiki ,这是将某些东西永久连接到 PATH 的正确方法。但它不起作用。有人能帮我弄清楚错在哪里吗?

[注意:添加相同的行没问题~/.bashrc。]

4

1 回答 1

0

根据给出的选项,bash可以作为交互式 shell登录 shell运行。默认的交互式 shell模式不读取~/.bash_profile. 登录 shell bash 做。

看:

首先,一些设置:

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

现在运行常规(交互式)bash:

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

请注意,我们没有得到最后yes一个。

现在使用登录外壳:

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

请参阅中的段落INVOCATIONman bash

于 2015-12-04T11:01:59.577 回答