shell脚本菜单
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell脚本菜单相关的知识,希望对你有一定的参考价值。
menu will only quit when 'q' is pressed
#!/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
以上是关于shell脚本菜单的主要内容,如果未能解决你的问题,请参考以下文章
用于确保在任何给定时间仅运行一个 shell 脚本的 shell 片段 [重复]