Interactive Shell Behavior (Bash Reference Manual)
Last updated
Was this helpful?
Last updated
Was this helpful?
When the shell is running interactively, it changes its behavior in several ways.
Startup files are read and executed as described in .
Job Control (see ) is enabled by default. When job control is in effect, Bash ignores the keyboard-generated job control signals SIGTTIN
, SIGTTOU
, and SIGTSTP
.
Bash expands and displays PS1
before reading the first line of a command, and expands and displays PS2
before reading the second and subsequent lines of a multi-line command. Bash expands and displays PS0
after it reads a command but before executing it. See , for a complete list of prompt string escape sequences.
Bash executes the value of the PROMPT_COMMAND
variable as a command before printing the primary prompt, $PS1
(see ).
Readline (see ) is used to read commands from the user’s terminal.
Bash inspects the value of the ignoreeof
option to set -o
instead of exiting immediately when it receives an EOF
on its standard input when reading a command (see ).
Command history (see ) and history expansion (see ) are enabled by default. Bash will save the command history to the file named by $HISTFILE
when a shell with history enabled exits.
Alias expansion (see ) is performed by default.
In the absence of any traps, Bash ignores SIGTERM
(see ).
In the absence of any traps, SIGINT
is caught and handled (see ). SIGINT
will interrupt some shell builtins.
An interactive login shell sends a SIGHUP
to all jobs on exit if the huponexit
shell option has been enabled (see ).
The -n invocation option is ignored, and ‘set -n’ has no effect (see ).
Bash will check for mail periodically, depending on the values of the MAIL
, MAILPATH
, and MAILCHECK
shell variables (see ).
Expansion errors due to references to unbound shell variables after ‘set -u’ has been enabled will not cause the shell to exit (see ).
The shell will not exit on expansion errors caused by var being unset or null in ${var:?word}
expansions (see ).
Redirection errors encountered by shell builtins will not cause the shell to exit.
When running in POSIX mode, a special builtin returning an error status will not cause the shell to exit (see ).
A failed exec
will not cause the shell to exit (see ).
Parser syntax errors will not cause the shell to exit.
Simple spelling correction for directory arguments to the cd
builtin is enabled by default (see the description of the cdspell
option to the shopt
builtin in ).
The shell will check the value of the TMOUT
variable and exit if a command is not read within the specified number of seconds after printing $PS1
(see ).