Bash/Job-Control-Builtins
Next: Job Control Variables, Previous: Job Control Basics, Up: Job Control [Contents][Index]
7.2 Job Control Builtins
bgbg [jobspec …]
Resume each suspended job
jobspecin the background, as if it had been started with ‘&’. Ifjobspecis not supplied, the current job is used. The return status is zero unless it is run when job control is not enabled, or, when run with job control enabled, anyjobspecwas not found or specifies a job that was started without job control.fgfg [jobspec]
Resume the job
jobspecin the foreground and make it the current job. Ifjobspecis not supplied, the current job is used. The return status is that of the command placed into the foreground, or non-zero if run when job control is disabled or, when run with job control enabled,jobspecdoes not specify a valid job orjobspecspecifies a job that was started without job control.jobsjobs [-lnprs] [jobspec] jobs -x command [arguments]
The first form lists the active jobs. The options have the following meanings:
-lList process IDs in addition to the normal information.
-nDisplay information only about jobs that have changed status since the user was last notified of their status.
-pList only the process ID of the job’s process group leader.
-rDisplay only running jobs.
-sDisplay only stopped jobs.
If
jobspecis given, output is restricted to information about that job. Ifjobspecis not supplied, the status of all jobs is listed.If the
-xoption is supplied,jobsreplaces anyjobspecfound incommandorargumentswith the corresponding process group ID, and executescommand, passing itarguments, returning its exit status.killkill [-s sigspec] [-n signum] [-sigspec] jobspec or pid kill -l|-L [exit_status]
Send a signal specified by
sigspecorsignumto the process named by job specificationjobspecor process IDpid.sigspecis either a case-insensitive signal name such asSIGINT(with or without theSIGprefix) or a signal number;signumis a signal number. Ifsigspecandsignumare not present,SIGTERMis used. The-loption lists the signal names. If any arguments are supplied when-lis given, the names of the signals corresponding to the arguments are listed, and the return status is zero.exit_statusis a number specifying a signal number or the exit status of a process terminated by a signal. The-Loption is equivalent to-l. The return status is zero if at least one signal was successfully sent, or non-zero if an error occurs or an invalid option is encountered.waitwait [-fn] [jobspec or pid …]
Wait until the child process specified by each process ID
pidor job specificationjobspecexits and return the exit status of the last command waited for. If a job spec is given, all processes in the job are waited for. If no arguments are given, all currently active child processes are waited for, and the return status is zero. If the-noption is supplied,waitwaits for a single job to terminate and returns its exit status. Supplying the-foption, when job control is enabled, forceswaitto wait for eachpidorjobspecto terminate before returning its status, intead of returning when it changes status. If neitherjobspecnorpidspecifies an active child process of the shell, the return status is 127.disowndisown [-ar] [-h] [jobspec … | pid … ]
Without options, remove each
jobspecfrom the table of active jobs. If the-hoption is given, the job is not removed from the table, but is marked so thatSIGHUPis not sent to the job if the shell receives aSIGHUP. Ifjobspecis not present, and neither the-anor the-roption is supplied, the current job is used. If nojobspecis supplied, the-aoption means to remove or mark all jobs; the-roption without ajobspecargument restricts operation to running jobs.suspendsuspend [-f]
Suspend the execution of this shell until it receives a
SIGCONTsignal. A login shell cannot be suspended; the-foption can be used to override this and force the suspension.
When job control is not active, the kill and wait
builtins do not accept jobspec arguments. They must be
supplied process IDs.
Next: Job Control Variables, Previous: Job Control Basics, Up: Job Control [Contents][Index]