At times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. The if construction allows you to specify such conditions.
Bash conditional if and case statements
![](https://horusec.info/wp-content/uploads/2017/05/if_else_statement.jpg)
At times you need to specify different courses of action to be taken in a shell script, depending on the success or failure of a command. The if construction allows you to specify such conditions.