linux else if code example
Example 1: bash else if
if [ "$animal" == "penguin" ]; then
echo "Hmmmmmm fish... Tux happy!"
elif [ "$animal" == "dolphin" ]; then
echo "Pweetpeettreetppeterdepweet!"
else
echo "*prrrrrrrt*"
fi
if TEST-COMMANDS; then
CONSEQUENT-COMMANDS;
elif MORE-TEST-COMMANDS; then
MORE-CONSEQUENT-COMMANDS;
else
ALTERNATE-CONSEQUENT-COMMANDS;
fi
Example 2: ash if statment
if [ "$USER" == "Adam" ]
then
echo "User is Adam"
else
echo "User is not Adam"
fi