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

Creating a Basic Script

As mentioned earlier, shell scripts can range from extremely basic to extremely complex. The example we reviewed earlier was a very simple script. It echoed text on the screen and ran one command. For your Linux+/LPIC 1 exam, you need to be able to create scripts that are much more complex than this. Therefore, in this part of the chapter, we’re going to cover the following topics:

• Displaying text on the screen

• Adding commands to a script

• Reading input from the user

Let’s begin by discussing how to display text on the screen in a shell script.

Displaying Text on the Screen

This task is pretty easy. As you saw in the earlier examples we reviewed, you can display text on the screen in a shell script using the echo ...

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