Job control (Unix): Difference between revisions

Content deleted Content added
Job ID: Edit for clarity
Job ID{{anchor |job ID}}: Edit for brevity
Line 23:
 
==Job ID{{anchor |job ID}}==
A job is identified by a numeric ''job ID'', a.k.a. ''job number'' which is classified as a [[Handle (computing)|handle]] since it is an abstract reference to a [[computer resource |resource]] (a process group). An ID value, prefixed with {{code|%}}, can be used with a job control command to specify a job. The special references {{code|%%}} and {{code|%+}} refer to the default job; the one that would be selected if none specified.<ref>IEEE Std 1003.1-2001, [http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203 Section 3.203, Job Control Job ID]</ref> Bash documentation refers to a reference (starting with {{code|%}}) as a ''jobspec'' (short for job specification).<ref>[https://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics 7.1 Job Control Basics]</ref>
 
When used with a job control command, an ID is prefixed with {{code|%}}. The special references {{code|%%}} and {{code|%+}} refer to the default job; the one that would be selected if none specified.<ref>IEEE Std 1003.1-2001, [http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_203 Section 3.203, Job Control Job ID]</ref> Bash documentation refers to a reference (starting with {{code|%}}) as a ''jobspec'' (short for job specification).<ref>[https://www.gnu.org/software/bash/manual/html_node/Job-Control-Basics.html#Job-Control-Basics 7.1 Job Control Basics]</ref>
 
Job control ID values are typically only used in an interactive shell. In scripting, PGID values are used instead, as they are more precise and robust, and indeed job control is disabled by default in a bash script.