Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #!/bin/bash
  2. #User input script
  3.  
  4. #Variables
  5. again=""
  6. name=""
  7. age=''
  8. occupation=""
  9. y=401K
  10. answer=""
  11.  
  12.  
  13. while [ "$again" != "n" ]
  14. do
  15.  
  16. #find out the user name
  17. echo -e "What is your name: "
  18. read -r name
  19. if [[ $name == [a-z] ]]
  20. then
  21. echo "Ha! A name contains letters, TRY AGAIN!"
  22. else
  23. echo "Hey $name"
  24. echo "You have ${#name} letters in your name"
  25. fi
  26. #find out the user age
  27. echo -e "What is your age: "
  28. read -r age
  29. echo "Nice, you are $age years old"
  30. #if they are over 18, Ask if they have a 401K
  31. if [ $age -lt 18 ]
  32. then
  33. echo "Stay in school"
  34. else
  35. echo -e "Do you have a 401(k) y or n: "
  36. read K401
  37.  
  38. if [ ${K401} == "y" ]
  39. then
  40. echo "Great"
  41. else
  42. echo " you should get one"
  43. fi
  44. fi
  45.  
  46. #find out user occupation
  47. echo -e "What is your occupation"
  48. read -r occupation
  49. echo "Oh cool, you are a $occupation"
  50.  
  51. #see if they are happy with their job
  52. echo -e "Do you enjoy being a $occupation, answer y or n: "
  53. read -r answer
  54. echo "You said $answer.....That's cool"
  55.  
  56. #Ask if they want to do it again
  57. echo -e "Do you want to do it again: y or n: "
  58. read again
  59. done
  60.  
  61. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement