URDINESH: SHELL SCRIPT FOR ELECTRICITY BILL PREPARATION
Showing posts with label SHELL SCRIPT FOR ELECTRICITY BILL PREPARATION. Show all posts
Showing posts with label SHELL SCRIPT FOR ELECTRICITY BILL PREPARATION. Show all posts

Tuesday, July 21, 2015

SHELL SCRIPT FOR ELECTRICITY BILL PREPARATION

ELECTRICITY BILL PREPARATION:


echo "enter the pmr cmr"
read  pmr cmr
echo "PreviousMonthReading: $pmr"
echo  "CurrentMonthReading: $cmr"
unit=`echo $cmr - $pmr |bc`
echo " unit  :  $unit"
if [ $unit -ge 200 ]
then
amt=`echo $unit \* 2.00 | bc`
else
 if [ $unit -lt 200 -a $unit -ge 100 ]
then
amt=`echo $unit \* 1.50 | bc`
 else
   amt=`echo $unit \* .50 | bc`
fi
fi
echo " Amount  : $amt"















OUTPUT:

[@localhost ~]$ sh eletricity.sh
enter the pvr cvr
700 950
PreviousMonthReading: 700
CurrentMonthReading: 950
 unit  :  250
 Amount  : 500.00

[@localhost ~]$

Followers