在 Ubuntu 默认 .bashrc 中有这个:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会这样?如果 shell 以非交互方式运行,那么 bashrc 中是否有某些东西无法运行?
.bashrc 文件的重点是它设置了 shell,以便于交互用户更方便。有用的别名、漂亮的颜色、有用的提示、常见的环境变量,诸如此类。
其中一些便利可能会破坏非交互式脚本。例如:
`alias rm='rm -i'`
Run Code Online (Sandbox Code Playgroud)
不能以非交互方式工作(感谢 zwets)。
归档时间: |
|
查看次数: |
1991 次 |
最近记录: |