bash multiple if else statements code example
Example 1: else if statement bash syntax
#!/bin/bash
read -p "Enter your marks: " marks
if [ $marks -ge 80 ]
then
echo "Very Good"
elif [ $marks -ge 50 ]
then
echo "Good"
elif [ $marks -ge 33 ]
then
echo "Just Satisfactory"
else
echo "Not OK"
fi
Example 2: if elif bqsh
if [ "$seconds" -eq 0 ];then
$timezone_string="Z"
elif[ "$seconds" -gt 0 ]
then
$timezone_string=`printf "%02d:%02d" $seconds/3600 ($seconds/60)%60`
else
echo "Unknown parameter"
fi