Thursday 12 September 2019

shell script to print number positive or negative

$ cat ppn.sh
# to print positive  or negative numbers
clear
echo " `tput cup 5 5` enter number:"
tput cup 5 30;read var
if [ $var -eq 0 ]
then
clear;tput cup 5 5;echo "zero"
elif [ $var -lt 0 ]
then
tput cup 7 5;echo "negative"
else
tput cup 7 5;echo "positive"
fi

No comments:

Post a Comment