Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有人显然只在 .zshrc 中向我推荐了以下代码,而没有清楚地解释其目的。
typeset -U PYTHONPATH
我对如何使用 .bashrc 中的代码感兴趣。我的 Bash 对这个命令感到不安。
如何在 Bash 中使用该命令?
该 zsh 命令很有用,因为zsh可以将环境变量 PYTHONPATH 视为实际的路径数组。的-U参数typeset说,然后在传递给程序(在本例中为 Python)的环境值中表示数组时,仅包含每个唯一值的第一个实例。
-U
typeset
在bash中,由于不导出数组变量,因此 PYTHONPATH 将只是一个普通的字符串变量,包含用冒号分隔的路径。因此,没有必要告诉bash只使用唯一值。