login-shell

bash: non-login shell和login shell的区别

♀尐吖头ヾ 提交于 2020-04-08 13:01:55
详细介绍可以察看info bash中的INVOCATION部分。此处仅作简要总结。 The difference between a login shell and a non-login shell (info bash) login shell *) interactive login shell *) non-interactive shell with --login option *) behavior *) it reads and executes /etc/profile if exists *) it looks for ~/.bash_profile, ~/.bash_login and ~/.profile, in that order and reads and executes the first one found non-login shell *) interactive non-login shell it reads and executes /etc/bash.bashrc and ~/.bashrc *) non-interactive non-login shell it first executes the following command before running the script if [ -n "$BASH_ENV" ];