Unix Processes and Shells
This module covers basic information about how shell scripts are executed on a UNIX system. Subsequent modules in this course will focus on the programming aspects of the shell. Before we begin those modules, we will look at the difference between using the shell as an interactive command interpreter and using it as a programming language.
We will also examine techniques available for running a shell script and go over what processes are started when you run the shell using the various techniques.
In this module, the following will be discussed:
- Determine your login shell
- Run a shell interactively
- Run a shell through a script
- Describe the relationship between parent and child processes
- Run a shell script using three different techniques
Processes and Process ID
An executing instance of a program is called a process.
Some operating systems use the term task to refer to a program that is being executed. The UNIX System guarantees that every process has a unique numeric identifier called the process ID. The process ID is always a non-negative integer.
The program in the figure below prints its process ID.
printf("hello world from process ID %ld\n", (long)getpid());