Posted By

Juanje on 06/19/08


Tagged

menu Bash options while


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

rwczippy
esritter
vkolev
vthreex
naesk


Tipical bash script option menu


 / Published in: Bash
 

  1. #!/bin/bash
  2.  
  3.  
  4. while [ "$#" -gt 0 ]
  5. do
  6. case $1 in
  7. -h | --help)
  8. echo "Show program help for $(basename $0)"
  9. shift
  10. ;;
  11. -l | --list)
  12. echo "List the options"
  13. shift
  14. ;;
  15. *)
  16. echo "Other options"
  17. shift
  18. ;;
  19. esac
  20. done
  21.  

Report this snippet  

You need to login to post a comment.