Bg built-in
The bg
built-in resumes suspended jobs in the background.
Synopsis
bg [job_id…]
Description
See Job control for an overview of job control in yash-rs. The built-in resumes the specified jobs by sending the SIGCONT
signal to them.
The (last) resumed job’s process ID is set to the !
special parameter.
Options
None.
Operands
Operands specify jobs to resume as job IDs. If omitted, the built-in resumes the current job.
Standard output
The built-in writes the job number and name of each resumed job to the standard output.
Errors
It is an error if:
- the specified job is not found,
- the specified job is not job-controlled, that is, job control was off when the job was started, or
- job control is off in the current shell environment.
Exit status
Zero unless an error occurs.
Examples
See Job control.
Compatibility
Many implementations allow omitting the leading %
from job IDs, though it is not required by POSIX.
Previous versions of yash allowed it, but this is not yet supported in yash-rs.
Some implementations (including the previous version of yash, but not this version) regard it is an error to resume a job that has already terminated.