#!/bin/bash
#if-else conditional statements
n=100
if [ $n -eq 100 ]
then
echo "n is 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
else
echo "n is not 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
elif [ $n -gt 100 ]
then
echo "n is greater than 100"
else
echo "n is less than 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
else
if [ $n -gt 100 ]
then
echo "n is greater than 100"
else
echo "n is less than 100"
fi
fi
#if-else conditional statements
n=100
if [ $n -eq 100 ]
then
echo "n is 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
else
echo "n is not 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
elif [ $n -gt 100 ]
then
echo "n is greater than 100"
else
echo "n is less than 100"
fi
n=99
if [ $n -eq 100 ]
then
echo "n is 100"
else
if [ $n -gt 100 ]
then
echo "n is greater than 100"
else
echo "n is less than 100"
fi
fi
No comments:
Post a Comment