Code:
echo -n "Enter the Number : "
read x
if [ $x -lt 0 ]
then
echo "$x is Negative"
elif [ $x -eq 0 ]
then
echo "Number entered is Zero"
else
echo "$x is Positive"
fi
Output:
[ty2011330@localhost ~]$ sh j02.sh
Enter the Number : 7
7 is Positive
[ty2011330@localhost ~]$ sh j02.sh
Enter the Number : -9
-9 is Negative
[ty2011330@localhost ~]$ sh j02.sh
Enter the Number : 0
Number entered is Zero
No comments:
Post a Comment