So, I have started studying UNIX systems about a month ago and now I have a basic question about job control
How can I create a job, that will contain several processes, using only default bash commands?
So, I have started studying UNIX systems about a month ago and now I have a basic question about job control
How can I create a job, that will contain several processes, using only default bash commands?
jobs
are usually an interactive shell concept, as there is usually a controlling terminal involved.
A shell script is executed in a non-interactive, non-login session of shell, hence no job control by default.
You can force job control inside a script, by setting:
set -m
inside the script.
From help set:
-m
Job control is enabled.
echo | ping google.com &
Was fine example, because both of these processes work independently and only require pipe symbol (|) to work in sync in the background