Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. # =======================================================
  2. # Script Name: phoneadd
  3. # By: Your initials here
  4. # Date: Today’s date
  5. # Purpose: A shell script that sets up a loop to add
  6. # new employees to the corp_phones file.
  7. # Command Line: phoneadd
  8. #
  9. # =======================================================
  10. trap "rm ~/tmp/* 2> /dev/null; exit" 0 1 2 3
  11. phonefile=~/source/corp_phones
  12. looptest=y
  13. while [ $looptest = y ]
  14. do
  15. clear
  16. tput cup 1 4; echo "Corporate Phone List Additions"
  17. tput cup 2 4; echo "=============================="
  18. tput cup 4 4; echo "Phone Number: "
  19. tput cup 5 4; echo "Last Name : "
  20. tput cup 6 4; echo "First Name : "
  21. tput cup 7 4; echo "Middle Init : "
  22. tput cup 8 4; echo "Dept # : "
  23. tput cup 9 4; echo "Job Title : "
  24. tput cup 10 4; echo "Date Hired : "
  25. tput cup 12 4; echo "Add Another? (y)es or (q)uit: "
  26. tput cup 4 18; read phonenum
  27. if [ "$phonenum" = "q" ]
  28. then
  29. clear; exit
  30. fi
  31. tput cup 5 18; read lname
  32. tput cup 6 18; read fname
  33. tput cup 7 18; read midinit
  34. tput cup 8 18; read deptno
  35. tput cup 9 18; read jobtitle
  36. tput cup 10 18; read datehired
  37. # Check to see if last name is not a blank before you
  38. # write to disk
  39. if [ "$lname" > " " ]
  40. then
  41. echo "$phonenum:$lname:$fname:$midinit:$deptno:$
  42. jobtitle:$datehired" >> $phonefile
  43. fi
  44. tput cup 12 33; read looptest
  45. if [ "$looptest" = "q" ]
  46. then
  47. clear; exit
  48. fi
  49. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement