Shell procedures are commands which have been grouped together to form a program. In order to create a shell procedure you must write the desired sequence of commands to a file. Enter sh <file name> to call a shell procedure. If the file possesses execution permission (chmod +x <file name>), you can call this command sequence directly, that is to say without sh.
This section describes the effect of the POSIX process structure when you are working with the POSIX shell, i.e. when you are entering commands or working with shell procedures.
Any input that you enter after /START-POSIX-SHELL is received by the POSIX shell and processed accordingly.
The most important commands are implemented as “built-in” commands. Some commands actually spawn a separate process, so the process in which the POSIX shell is running thus becomes a parent process.
Basically, any process can spawn a new process. Until the process spawns another process it is the child process of a parent process. However, as soon as it generates a new process it becomes the parent process of the new child process. It nevertheless retains its status as the child process of the process to which it is subordinate. In other words, a process can simultaneously be a parent process and a child process.
The parent-child process hierarchy is of great importance if you want to pass environment variables in shell procedures. All users can define the environment variables with which they wish their POSIX shell (= parent process) to operate. However, these environment variables are initially known only by the POSIX shell. If a child process is to operate with the environment variables used in the parent process (= POSIX shell) then these variables must be exported to the child process. The export command is available for this purpose.