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
Save this page to any social bookmarking site! Share · search Search · store Market · star Directory
2018-11-14 · John December · Contact · Terms of Use © December Communications, Inc.