This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
commands:builtin:wait [2012/10/20 11:20]
thebonsai created
commands:builtin:wait [2020/06/28 06:56] (current)
thebonsai [Table]
Line 2: Line 2:
 ===== Synopsis ===== ===== Synopsis =====
-<​code>​wait [ID]</​code>​+<​code>​wait ​[-f] [-n] [-p VARNAME] ​[ID...]</​code>​
 ===== Description ===== ===== Description =====
-The ''​wait''​ builtin command is used to +The ''​wait''​ builtin command is used to wait for job completion and return exit status. 
-  * wait for a specific job (asynchronous command) and report its exit status if the ''​ID''​ is given + 
-  * wait for all running jobs (asynchronous commands)+  * if ''​ID''​ is a job specification,​ it waits for all processes in the pipeline of this job 
 +  * waits for a specific job (asynchronous command) and report its exit status if one or more ''​ID''​ is given 
 +  * waits for all running jobs (asynchronous commands) 
 +  * waits for "the next" job (''​-n''​ option) 
 +  * waits for termination instead of status change (''​-f''​ option) 
 +''​ID''​ may be an operating system process identifier or a shell job specification.
 ==== Options ==== ==== Options ====
-There are no options.+^ Option ​         ^ Description ​                                                                                                                       ^ 
 +| ''​-n'' ​         | Waits for "the next" child to exit (as opposed to "all children"​ without this option)Accepts a list of IDs (jobs) ​               | 
 +| ''​-f'' ​         | Waits for the termination of the given ''​ID''​ (instead of waiting for a status change only)                                        | 
 +| ''​-p VARNAME'' ​ | When waiting for a list (-n) or all jobs, writes the job ID to the job that was actually terminated into the variable ''​VARNAME'' ​ | 
 +==== Return status ====
-==== Exit status ​====+The return ​status ​is the return status of the job waited for, or
-  * when waiting ​for a specific given jobthe return status of ''​wait''​ is the return status of the job it waited for +^Status ​ ^Reason ​ ^ 
-  * when waiting for all jobs (no specific ID given), the return status is zero (0)+|0     ​|waited ​for all jobs in shell'​s ​job list  | 
 +|1     |the given ''​ID''​ is not a valid job or process ID  |
 ===== Examples ===== ===== Examples =====
  • commands/builtin/wait.1350732008.txt
  • Last modified: 2012/10/20 11:20
  • by thebonsai