如何用 zsh 协调 bash 配置文件



我最近把我的shell从bash换成了zsh。我通过 bash 设置了 Anaconda,但现在我运行 zsh 作为我的默认 shell,我找不到 conda,更重要的是,Jupyter。我认为要访问Jupyter,我可以使用exec bash -l,但这似乎是毫无意义的暂时的。我宁愿从zsh本地访问Jupyter。有没有办法将 zsh 链接回 bash 配置?

由于 zsh 可以解释大部分 bash,你可以让它将 bash init 文件包含在相应的 init 文件中。

为此,请添加例如行source ~/.bashrc~/.zshrc

每个 shell 都有许多不同的配置文件,它们不对应 1:1,所以请浏览并查看要链接哪些配置文件。例如,zsh login shells 读取.zlogin.zprofile,而 bash login shell 只读取第一个可用的.bash_profile.bash_login.profile

我在.bash_profile中正确设置了 PATH 后遇到了mysql: command not found问题。

对我有用的是以下几点:

  1. source ~/.bash_profile添加到~/.zprofile的第一行
  2. 重新启动终端

最新更新