8.1 Shell and Shell Script

Let's learn about shell and shell script before beginning shell programming.

In Chapter 1, we learned about the kernel. The kernel is the core of the OS(Operating System), so it has various important roles like hardware handling.

Shell derives from shells which are living in the sea. Because it is wrapping the kernel, and provides interactive communication function between human and the kernel.

Shell receives commands inputted by users, let the kernel do them and returns their results to the users. For example, a user executes ls command and gets its results as follows.


$ ls ↵
file_a file_b ....

In this case, after displaying prompt '$', shell was waiting for the command input. When a user entered ls command, the shell let the system execute ls command and displayed its results, ie. 'file.a file.b ...'.

The shell's command reception and execution was explained.

Next, let's imagine cases in which those commands should be executed continuously. The user has to enter those commands by hands continuously, if there is no way to automate.

The shell script is the way to let such continuous commands execute automatically. This script can also control conditional branches and loops systematically. This is the shell script programming.

Previous Next