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 ~]$
No comments:
Post a Comment
Thanks for your valuable comments