Processing the Background (Forking a Process)

Assume the file "myscript" contains a Unix program or script and is executable.

At the shell prompt you can execute myscript by writing its name and pressing the "Enter" key.

$ myscript

If myscript takes a very long time to run, you just have to sit there and wait for it to complete before you are going to get back the shell prompt.

You avoid having to wait by using the & symbol after the myscript name. This forces myscript to run in the background, giving you back the shell prompt immediately so that you can do something else while myscript runs. When you do this, some Unix shells will tell you that one process has started and show its process identification (PID) number.

$ myscript &
[1] 32415
$ 
search Search · star Market
2023-06-01 · John December · Terms © johndecember.com