C – If-Else Statement The if-else statements are used to run specific code based on condition. The if statement executes a statement if a specified condition is true. If the condition is false, another statement can be executed. Basically, there are 4 types of if statements. if statement if-else statement if-else-if ladder statement nested if statement 1. if Statement An if statement evaluates the expression written inside the parenthesis. if (Expression) { // statement block } If the expression returns true, The if statement block will be executed. If the…
Read MoreTag: else
Bash – If-else
Bash if else Statment If-else is the decision making statements in bash scripting similar to any other programming. Where execution of a block of statement is decided based on the result of if condition. If it evaluates a condition to true, then if block code is executed, on the false condition, the else block code is executed, which is optional. Syntax:
1 2 3 4 5 6 | if [condition] then //if block code else // else block code fi |
basically, there are 4 types of if statements. if statement if-else statement else-if ladder statement nested if statement 1. Bash – if Statement Example This is the basic…
Read More