1. #!/bin/bash
2. echo "Please chose a number, 1: run w, 2: run top, 3: run free, 4: quit"
3. echo
4. select command in w top free quit
5. do
6. case $command in
7. w)
8. w
9. ;;
10. top)
11. top
12. ;;
13. free)
14. free
15. ;;
16. quit)
17. exit
18. ;;
19. *)
20. echo "Please input a number:(1-4)."
21. ;;
22. esac
23. done
原文:http://blog.51cto.com/amazing61/2063860