Conditional Statements
Conditions allow scripts to make decisions.
If statement
Example:
#!/bin/bash
age=20
if [ $age -ge 18 ] then echo "Adult" fi
Output:
Adult If-Else statement #!/bin/bash
if [ -f file.txt ] then echo "File exists" else echo "File not found" fi