在我的拱安装,/etc/bash.bashrc
以及/etc/skel/.bashrc
包含这些行:
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
Run Code Online (Sandbox Code Playgroud)
在 Debian 上,/etc/bash.bashrc
有:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Run Code Online (Sandbox Code Playgroud)
并且/etc/skel/.bashrc
:
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
Run Code Online (Sandbox Code Playgroud)
man bash
然而,根据,非交互式 shell 甚至不读取这些文件:
When bash is started non-interactively, to run a shell script, for
example, it looks for the variable …
Run Code Online (Sandbox Code Playgroud)