Virajsinh

Shell_Script_OS_Database

Nov 2nd, 2017
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. i=1;
  2. j=1;
  3. echo -n "Enter Database Name : "
  4. read emp
  5.  
  6. while [ $i = 1 ]
  7. do
  8. echo "-----------------------------------"
  9. echo "1. Add Employee Record."
  10. echo "2. View Employe3 Record."
  11. echo "3. Modify Employee Record."
  12. echo "4. Count Total No Of Employee."
  13. echo "5. Employee Gros And Salary."
  14. echo -n "Enter Choose : "
  15. read ch
  16.  
  17. case $ch in
  18.  
  19. 1) echo -n "Emp_Name : "
  20. read emp_name;
  21.  
  22. echo -n "Emp_Gender : "
  23. read emp_gender;
  24.  
  25. echo -n "Emp_Desiganation : "
  26. read emp_desi;
  27.  
  28. echo -n "Emp_Salary :"
  29. read emp_salary;
  30.  
  31. echo "$j|$emp_name|$emp_gender|$emp_desi|$emp_salary" >> $emp;
  32. j=`expr $j + 1`;
  33. ;;
  34.  
  35. 2) sort -n -k1 $emp;
  36. ;;
  37.  
  38. 3) echo "Enter Emp_No :"
  39. read n;
  40.  
  41. grep -i "$n" $emp | tee x;
  42. wc -c x | tee y;
  43. a=`cut -d " " -f 1 y`
  44. if [ "$a" = 0 ]
  45. then
  46. echo "Record not found"
  47. else
  48. echo -n "Emp_Name : "
  49. read emp_name;
  50.  
  51. echo -n "Emp_Gender : "
  52. read emp_gender;
  53.  
  54. echo -n "Emp_Desiganation : "
  55. read emp_desi;
  56.  
  57. echo -n "Emp_Salary :"
  58. read emp_salary;
  59.  
  60. grep -v "$n" $emp | cat > def;
  61. cat def | tee $emp;
  62. echo "$n|$emp_name|$emp_gender|$emp_desi|$emp_salary" >> $emp;
  63. fi
  64. ;;
  65.  
  66. 4) wc -l $emp;
  67. ;;
  68.  
  69. 5) echo -n "Enter No. ";
  70. read temp;
  71. grep -i "$temp" $emp | tee sal;
  72. echo
  73.  
  74. salary=`cut -d "|" -f5 sal`;
  75.  
  76. hra=$((( $salary \* 5 ) / 100));
  77. da=$((( $salary \* 13 ) / 100));
  78. ta=800;
  79. tax=$((( $salary \* 5 ) / 100));
  80. gs=$(( $salary + $hra + $da + $ta));
  81. ns=$(( $gs - $tax));
  82.  
  83. echo "Gross Salary : $gs";
  84. echo "Neet Salary : $ns";
  85. ;;
  86.  
  87. 6) sort -n $emp;
  88. ;;
  89.  
  90. *) exit
  91. ;;
  92.  
  93. esac
  94.  
  95. echo -n "Do You Want To Conti...?"
  96. read i
  97. echo "-----------------------------------"
  98. if [ $i = 0 ]
  99. then
  100. exit
  101. fi
  102. done
Add Comment
Please, Sign In to add comment