This question pertains specifically to shell scripts, but could be about any programming language.
Is there any difference between using multiple if
stateme
When you have multiple if statements, each is evaluated separately, and if the conditions are right, the code in all of them might be executed. If you have if / elif statement, the second condition would be evaluated only after particular result of the evaluation of the first condition.
Consider this pseudocode:
If (cond A) { action 1}
If (cond B) { action 2}
If both cond A and cond B are true, both actions will execute.
On the other hand, this pseudocode:
If (cond A) {action 1}
Elif (cond B) {action 2}
Only one of the two actions (or neither) will be executed, no matter how both conditions evaluate.