Virajsinh

Shell_Script_OS_Database_3

Nov 19th, 2017
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #write a shellscript simple library mangment system database file contain fiedls like account number, title, author, addition(1st,2nd etc), Publistion.
  2.  
  3. #View Record
  4. #Add Record
  5. #Delete Record
  6. #Count Total Number Of Record
  7. #Get The Name Of Publiser Particale Name Of Author
  8. #Exit
  9.  
  10. i=1;
  11. j=1;
  12. echo -n "Enter Database Name : "
  13. read lib
  14.  
  15. while [ $i = 1 ]
  16. do
  17. echo "-----------------------------------"
  18. echo "1. Add Library Record."
  19. echo "2. View Library Record."
  20. echo "3. Delete Library Record."
  21. echo "4. Total Count Record."
  22. echo "5. Get Name Of The Publiser."
  23. echo "6. Exit."
  24. echo "-----------------------------------"
  25. echo -n "Enter Choose : "
  26. read ch
  27.  
  28. case $ch in
  29.  
  30. 1) #Add_Record
  31. echo -n "Book Number : "
  32. read bk_num;
  33.  
  34. echo -n "Book Title Name : "
  35. read title;
  36.  
  37. echo -n "Author Name : "
  38. read author;
  39.  
  40. echo -n "Addition : "
  41. read add;
  42.  
  43. echo -n "Publiser Name : "
  44. read pub;
  45.  
  46. echo "$bk_num | $title | $author | $add | $pub" >> $lib;
  47. ;;
  48.  
  49. 2) #Display_List
  50. sort -n -k1 $lib;
  51. ;;
  52.  
  53. 3) #Delte_Record
  54. grep -v "$bk_num" $lib > delete.txt
  55. rm $lib
  56. mv delete.txt $lib
  57. ;;
  58.  
  59. 4) #Total_Count_Record
  60. echo "Total | Database"
  61. wc -l $lib;
  62. ;;
  63.  
  64. 5) #Get_Name_Of_Publiser
  65. cut -d "|" -f5 $lib > PName.txt
  66. cat PName.txt
  67. ;;
  68.  
  69. *) exit
  70. ;;
  71.  
  72. esac
  73.  
  74. echo -n "Do You Want To Conti... (1 Conti.. / 2 Exit) ? "
  75. read i
  76. echo "-----------------------------------"
  77. if [ $i = 0 ]
  78. then
  79. exit
  80. fi
  81. done
Add Comment
Please, Sign In to add comment