Advertisement
Guest User

My script

a guest
Sep 26th, 2011
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. function choose {
  2.  
  3. echo " What does NLX stand for"
  4.  
  5. local default="$1"
  6. local prompt="$2"
  7. local choice_yes="$3"
  8. local choice_no="$4"
  9. local answer
  10.  
  11. read -p prompt answer
  12. [ -z "$answer" ] && answer="$default"
  13.  
  14. case "$answer" in
  15. [yY1] ) eval "$choice_yes"
  16. #error check
  17. ;;
  18. [nNo] eval "choice_no"
  19. #error check
  20. ;;
  21. * ) printf "%b" "Unexpected Answer '$answer'" >&2 ;;
  22. esac
  23.  
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement