【发布时间】:2016-08-01 07:41:54
【问题描述】:
我在这里尝试使用一个非常基本的设置模式:我有两个不同的给定工具安装(ocamlc,但这并不重要)。为了选择一种工具,我尝试通过添加一个条目来覆盖 PATH 变量。
% where ocamlc
/home/choeger/ueb/uebb/amsun-integration/Runtime/test_src/../../opam/4.02.3/bin/ocamlc
/home/choeger/.opam/4.02.3/bin/ocamlc
/usr/bin/ocamlc
但是,zsh 仍然使用旧条目:
% ocamlc -v
The OCaml compiler, version 4.02.3
Standard library directory: /home/choeger/.opam/4.02.3/lib/ocaml
(可以看到它使用了第二个条目,因为库目录是硬编码到该安装的)
Bash 的行为符合预期:
% bash -c "ocamlc -v"
The OCaml compiler, version 4.02.3
Standard library directory: /home/choeger/ueb/uebb/amsun-integration/opam/4.02.3/lib/ocaml
那么为什么 zsh 会忽略第一个 PATH 条目,尽管它会将其列为 where 的第一个元素?
编辑: 为了验证 zsh 没有调用相同的二进制文件,这里是另一个运行:
% type -a ocamlc
ocamlc is /home/choeger/ueb/uebb/amsun-integration/tests/pendulum/../../opam/4.02.3/bin/ocamlc
ocamlc is /home/choeger/.opam/4.02.3/bin/ocamlc
ocamlc is /usr/bin/ocamlc
% ocamlc -v
The OCaml compiler, version 4.02.3
Standard library directory: /home/choeger/.opam/4.02.3/lib/ocaml
% /home/choeger/ueb/uebb/amsun-integration/tests/pendulum/../../opam/4.02.3/bin/ocamlc -v
The OCaml compiler, version 4.02.3
Standard library directory: /home/choeger/ueb/uebb/amsun-integration/opam/4.02.3/lib/ocaml
编辑2: 这是 setopt 的输出:
% setopt
autocd
autopushd
nobeep
completeinword
correct
extendedglob
extendedhistory
histignorealldups
histignorespace
nohup
interactive
interactivecomments
longlistjobs
monitor
nonomatch
pushdignoredups
shinstdin
zle
%
Config 是找到的 grml 配置 here 加上 .local 文件中的一些路径变量。
【问题讨论】:
标签: shell path command zsh resolution