bash if else el code example
Example 1: if else statement example in shell script
if [ ... ]
then
# if-code
else
# else-code
fi
Example 2: bash if
#!/bin/bash
foo="qux"
bar="qux"
if [ "$foo" = "$bar" ]; then
echo "The strings are equal."
else
echo "The strings aren't equal."
fi