When you begin a terminal session, the operating system starts a single parent process . Creating a new process from an existing process is called forking . This new process is called a child process and has its own unique process identifier . A child process can fork another process and become a parent. A process which is not receiving input from the terminal, either running or stopped, is in the background.
When you issue a command to the shell, except for built-in
commands such as cd, exec or set, the shell
forks a child process for the command to
run in. The parent process remains dormant
until the child
process completes or is stopped, then control returns
to the parent.
The ps command can be used to print the status of active processes.
ps [options]
This forking of a child process when you run a script can be confusing because the parent process is not affected by the child process. For example, if you change the value of a shell variable in a script, this change will not be seen by the parent shell. If you are using the C shell you can use the source command to cause the current shell or process to execute a script. If you are using the Bourne shell, type
. filenameNote the space between the . and the filename.