Differences between version 3 and predecessor to the previous major change of JobControl.
Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 3 | Last edited on Wednesday, May 2, 2007 3:01:20 pm | by BenStaz | Revert |
Older page: | version 2 | Last edited on Wednesday, December 6, 2006 7:37:24 pm | by PerryLorier | Revert |
@@ -6,8 +6,23 @@
;fg ''jobid'':Moves stopped, or backgrounded ''jobid'' into the foreground
;kill %''jobid'':Send a signal to a job
;Control-Z:Suspend the currently running job
;jobs:List all current jobs.
+
+!bg,fg and kill are not limited to jobids.
+
+We can also specify the start or part of the job command.
+
+For example: If a job command consisted of ''ping www.google.co.nz'', then these commands are valid.
+
+*kill %ping
+*kill %?google
+*fg ping
+*bg ?google.co.nz
+
+These will work as long as you don't supply an ambiguous job_spec.
+Notice that, only kill requires the ''%'' so that it knows we are providing it with a job_spec rather than a process id.
+
!!How this works
Internally each command line (job) gets it's own ProcessGroup assigned to it by the shell when it creates the job using [setsid(2)]. While the command is running in the foreground it recieves any signals from the tty layer (such as [SIGTSTP], [SIGINT], [SIGQUIT], [SIGHUP] etc).