A login shell is one whose first character of argument zero is a -, or one started with the --login option.
An interactive shell is one started without non-option
arguments (unless -s is specified) and without the -c
option, whose standard input and error are both connected
to terminals (as determined by isatty(3)), or one started
with the -i option. PS1 is set and $- includes i if bash
is interactive, allowing a shell script or a startup file
to test this state.
When bash is invoked as an interactive login shell, or as a non-
interactive shell with the --login option, it reads
/etc/profile, if that file exists.
After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile
When an interactive login shell exits, or a non-interactive login shell
executes the exit builtin command, bash reads and executes commands
from the file ~/.bash_logout, if it exists.
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc
Comments
Post a Comment