To understand how shell scripts work, you need to know the following:
• The components of a shell script
• How shell scripts are executed
Let’s begin by discussing the components of a shell script.
As we mentioned, a shell script is a simple text file that contains a series of commands that are executed from top to bottom. Here is a sample shell script named runme:
Notice that this script contains several parts:
• #!/bin/bash The first line of any shell script must specify which shell the script is written to run under. In this case, the /bin/bash shell is specified. When a script is ...