echo "Enter consumption in units"
read cu
if [ $cu -gt 600 ]
then
echo "Rs.425 plus Re.1.25 per unit excess of 600"
s= echo "425 + 1.25 * $cu"|bc
echo "$s"
elif [ $cu -gt 400 ]
then
echo "Rs.230 plus Re.0.80 per unit excess of 400"
s= echo "230 + 0.80 * $cu"|bc
echo "$s"
elif [ $cu -gt 200 ]
then
echo "Rs.100 plus Re.0.65 per unit excess of 200"
s= echo "100 + 0.65 * $cu"|bc
echo "$s"
else
s= echo "0.50 * $cu"|bc
echo "$s"
fi
OUTPUT
biswarup@biswarup-desktop:~$ sh
$ sh electric.sh
Enter consumption in units
220
Rs.100 plus Re.0.65 per unit excess of 200
243.00
read cu
if [ $cu -gt 600 ]
then
echo "Rs.425 plus Re.1.25 per unit excess of 600"
s= echo "425 + 1.25 * $cu"|bc
echo "$s"
elif [ $cu -gt 400 ]
then
echo "Rs.230 plus Re.0.80 per unit excess of 400"
s= echo "230 + 0.80 * $cu"|bc
echo "$s"
elif [ $cu -gt 200 ]
then
echo "Rs.100 plus Re.0.65 per unit excess of 200"
s= echo "100 + 0.65 * $cu"|bc
echo "$s"
else
s= echo "0.50 * $cu"|bc
echo "$s"
fi
OUTPUT
biswarup@biswarup-desktop:~$ sh
$ sh electric.sh
Enter consumption in units
220
Rs.100 plus Re.0.65 per unit excess of 200
243.00
No comments:
Post a Comment