Differences between current version and previous revision of bash(1)Part5.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 2 | Last edited on Friday, July 2, 2004 3:47:35 pm | by JohnMcPherson | |
Older page: | version 1 | Last edited on Friday, November 21, 2003 1:34:14 pm | by JohnMcPherson | Revert |
@@ -358,15 +358,15 @@
__Bash__ itself returns the exit status of the last command executed, unless a syntax error occurs, in which case it exits with a non-zero value. See also the __exit__ builtin command below.
!!SIGNALS
-When __bash__ is interactive, in the absence of any traps, it ignores __SIGTERM__ (so that __kill __ does not kill an interactive shell), and __SIGINT__ is caught and handled (so that the __wait__ builtin is interruptible). In all cases, __bash__ ignores __
SIGQUIT__
. If job control is in effect, __bash__ ignores __
SIGTTIN__
, __
SIGTTOU__
, and __
SIGTSTP__
.
+When __bash__ is interactive, in the absence of any traps, it ignores __SIGTERM__ (so that __kill __ does not kill an interactive shell), and __SIGINT__ is caught and handled (so that the __wait__ builtin is interruptible). In all cases, __bash__ ignores [
SIGQUIT]
. If job control is in effect, __bash__ ignores [
SIGTTIN]
, [
SIGTTOU]
, and [
SIGTSTP]
.
-Synchronous jobs started by __bash__ have signal handlers set to the values inherited by the shell from its parent. When job control is not in effect, asynchronous commands ignore __
SIGINT__
and __
SIGQUIT__
as well. Commands run as a result of command substitution ignore the keyboard-generated job control signals __
SIGTTIN__
, __
SIGTTOU__
, and __
SIGTSTP__
.
+Synchronous jobs started by __bash__ have signal handlers set to the values inherited by the shell from its parent. When job control is not in effect, asynchronous commands ignore [
SIGINT]
and [
SIGQUIT]
as well. Commands run as a result of command substitution ignore the keyboard-generated job control signals [
SIGTTIN]
, [
SIGTTOU]
, and [
SIGTSTP]
.
-The shell exits by default upon receipt of a __
SIGHUP__
. Before exiting, it resends the __
SIGHUP__
to all jobs, running or stopped. Stopped jobs are sent __
SIGCONT__
to ensure that they receive the __
SIGHUP__
. To prevent the shell from sending the signal to a particular job, it should be removed from the jobs table with the __disown__ builtin (see __SHELL BUILTIN COMMANDS__ below) or marked to not receive __
SIGHUP__
using __disown -h__ .
+The shell exits by default upon receipt of a [
SIGHUP]
. Before exiting, it resends the [
SIGHUP]
to all jobs, running or stopped. Stopped jobs are sent [
SIGCONT]
to ensure that they receive the [
SIGHUP]
. To prevent the shell from sending the signal to a particular job, it should be removed from the jobs table with the __disown__ builtin (see __SHELL BUILTIN COMMANDS__ below) or marked to not receive [
SIGHUP]
using __disown -h__ .
-If the __huponexit__ shell option has been set with __shopt__ , __bash__ sends a __
SIGHUP__
to all jobs when an interactive login shell exits.
+If the __huponexit__ shell option has been set with __shopt__ , __bash__ sends a [
SIGHUP]
to all jobs when an interactive login shell exits.
When __bash__ receives a signal for which a trap has been set while waiting for a command to complete, the trap will not be executed until the command completes. When __bash__ is waiting for an asynchronous command via the __wait__ builtin, the reception of a signal for which a trap has been set will cause the __wait__ builtin to return immediately with an exit status greater than 128, immediately after which the trap is executed.
!!JOB CONTROL
@@ -379,9 +379,9 @@
indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of the processes in a single pipeline are members of the same job. __Bash__ uses the ''job'' abstraction as the basis for job control.
-To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a ''current terminal process group ID. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard-generated signals such as __
SIGINT__
. These processes are said to be in the ''foreground'' . ''Background'' processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-generated signals. Only foreground processes are allowed to read from or write to the terminal. Background processes which attempt to read from (write to) the terminal are sent a __
SIGTTIN (SIGTTOU)__
signal by the terminal driver, which, unless caught, suspends the process.
+To facilitate the implementation of the user interface to job control, the operating system maintains the notion of a ''current terminal process group ID. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard-generated signals such as [
SIGINT]
. These processes are said to be in the ''foreground'' . ''Background'' processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-generated signals. Only foreground processes are allowed to read from or write to the terminal. Background processes which attempt to read from (write to) the terminal are sent a [
SIGTTIN]
([
SIGTTOU]
) signal by the terminal driver, which, unless caught, suspends the process.
If the operating system on which __bash__ is running supports job control, __bash__ contains facilities to use it. Typing the ''suspend'' character (typically __^Z__ , Control-Z) while a process is running causes that process to be stopped and returns control to __bash__ . Typing the ''delayed suspend'' character (typically __^Y__ , Control-Y) causes the process to be stopped when it attempts to read input from the terminal, and control to be returned to __bash__ . The user may then manipulate the state of this job, using the __bg__ command to continue it in the background, the __fg__ command to continue it in the foreground, or the __kill__ command to kill it. A __^Z__ takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded.
There are a number of ways to refer to a job in the shell. The character __%__ introduces a job name. Job number ''n'' may be referred to as __%n__ . A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in its command line. For example, __%ce__ refers to a stopped __ce__ job. If a prefix matches more than one job, __bash__ reports an error. Using __%?ce__ , on the other hand, refers to any job containing the string __ce__ in its command line. If the substring matches more than one job, __bash__ reports an error. The symbols __%%__ and __%+__ refer to the shell's notion of the ''current job'' , which is the last job stopped while it was in the foreground or started in the background. The ''previous job'' may be referenced using __%-__ . In output pertaining to jobs (e.g., the output of the __jobs__ command), the current job is always flagged with a __+__ , and the previous job with a __-__ .