Gross salary if HRA DA is given with condition coderinme

Gross salary if HRA DA is given with condition coderinme

To compute Gross salary if HRA DA is given with condition coderinme other allowances like
DA: Dear Allowance = some % of Basic Salary
HRA: House Rent Allowance = some % of Basic Salary
We just have to add up them all using the following formula:
Gross Salary = BS + DA + HRA
Let us suppose if the basic salary is less than 1500 then the HRA is 10% of basic salary and DA is 90% of the basic salary. And if the basic salary is greater than or equal to 1500 then the HRA is 50% of the basic salary and the DA is 98% of the basic salary. So calculate the gross salary if the HRA, DA is given with the above mentioned conditions.
It’s only a matter of bash shell script.
So let’s find the solution of


#!/bin/bash
(bash copy)
read -p "Enter the salary: " sal
if [[ $sal -ge "1500" ]]
then
tot=`awk "BEGIN {printf \"%.2f\n\", 500 + 0.98 * $sal + $sal}"`
elif [[ $sal -lt "1500" ]]
then
tot=`awk "BEGIN {printf \"%.2f\n\", 0.10 * $sal + 0.98 * $sal + $sal}"`
fi
echo "Gross salary is: "$tot

For more linux bash problem
ls listing
gross salary
sum of digits

Leave a reply:

Your email address will not be published.