O'Reilly logo

LPIC-1/CompTIA Linux+™ Certification All-in-One Exam Guide by Robb Tracy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Shell Scripts

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.

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:

Image

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required