/ Published in: Bash
menu will only quit when 'q' is pressed
Expand |
Embed | Plain Text
#!/bin/sh echo "Use one of the following options" echo " d : run date command" echo " <?> : <another thing to do ...>" echo " q: quit this menu" echo "enter your choice or type "q" to quit : \c" read option while [ "$option" != "q" ] do case $option in d ) date shift echo "enter your choice or type "q" to quit : \c" read option ;; <?> ) <another command...> shift echo "enter your choice or type "q" to quit : \c" read option ;; # ... * ) echo "invalid choice!" shift echo "enter your choice or type "q" to quit : \c" read option ;; q ) exit 0 ;; esac done exit 0
Comments
Subscribe to comments
You need to login to post a comment.

Nice one. I have one more menu done in cat.
http://unstableme.blogspot.com/2008/06/bash-script-menu.html