O'Reilly logo

Fundamentals of Linux by Oliver Pelz

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

Implementing Bash shell scripting

Besides the logical and and or expressions that we used in the previous section, if we need to make a decision based on a command's exit status, variable value, command output, and so on, we need to understand the if statement or conditional branch. In plain words, the if statement means that, based on some condition, our script or command line should perform one action, otherwise it should perform something else.

Let's work with the exit code from the previous section again to demonstrate:

In this example, we issued the ls command to see the content of the oiip home directory. We stored the exit status of ...

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