Linux Fundamentals - Part 7: Bash Scripting (If Statements)
Source: Dev.to
If Statements
If statements execute code based on a condition. If the condition is true, the code block will run.
The condition is enclosed in square brackets [ ] and the statement ends with fi, which is if spelled backward, marking the end of the if block.
Example: Basic If Statement
num=15
if [ $num -gt 10 ]; then
echo "Number is greater than 10"
fi