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

Get Fundamentals of Linux now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.