【问题标题】:zsh doesn't use my $PATH correctzsh 没有正确使用我的 $PATH
【发布时间】:2014-09-24 00:06:10
【问题描述】:

我尝试从 ~/.dotfiles/bin 运行脚本,但 zsh 没有得到它,而是 bash:

➜  ~  cat ~/.dotfiles/bin/dotfiles-test 
#!/bin/bash
echo 'hello world'
➜  ~  echo $PATH
/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
➜  ~  dotfiles-test
zsh: command not found: dotfiles-test
➜  ~  bash
bash-3.2$ source .exports 
bash-3.2$ echo $PATH
/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin/:~/.dotfiles/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
bash-3.2$ dotfiles-test 
hello world
bash-3.2$ 

【问题讨论】:

  • 你记得chmod +x dotfiles-test吗?

标签: bash path zsh oh-my-zsh dotfiles


【解决方案1】:

只需将~/.dotfiles/bin 替换为$HOME/.dotfiles/bin

【讨论】:

    猜你喜欢
    • 2017-06-17
    • 2014-01-16
    • 2017-08-30
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多