In this script it gets the employee details as the input. Employee list scripting take input as allowance,deduction,basic we are storing these variable in $all, $ded,$basic,, by using the Linux and UNIX bash scripting we can calculate gross and net. CS1252 Operating Systems lap
Source code bash shell Programming Algorithm
get()
{
echo “ Enter code, allowance, deduction, basic pay ”
read code
read all
read ded
read basic
}
display()
{
echo “ The code is $code ”
echo “ The allowance is $all ”
echo “ The deduction is $ded ”
echo “ The basic pay is $basic ”
}
get $code $all $ded $basic
gross=`expr $bacis + $all`
net=`expr $gross - $ded`
echo “ The gross is $gross ”
echo “ The net is $net ”
OUTPUT CS1252 Operating Systems lap display Employee List
[redhat35@localhost Rhel5]$sh emp.sh
Enter code, allowance, deduction, basic pay
100
200
300
400
The gross is 600
The net is 300
Source code bash shell Programming Algorithm
get()
{
echo “ Enter code, allowance, deduction, basic pay ”
read code
read all
read ded
read basic
}
display()
{
echo “ The code is $code ”
echo “ The allowance is $all ”
echo “ The deduction is $ded ”
echo “ The basic pay is $basic ”
}
get $code $all $ded $basic
gross=`expr $bacis + $all`
net=`expr $gross - $ded`
echo “ The gross is $gross ”
echo “ The net is $net ”
OUTPUT CS1252 Operating Systems lap display Employee List
[redhat35@localhost Rhel5]$sh emp.sh
Enter code, allowance, deduction, basic pay
100
200
300
400
The gross is 600
The net is 300
0 Comments