简体   繁体   English

Ubuntu Shell脚本菜单

[英]Ubuntu shell script menu

I am new to shell scripting/ programming. 我是Shell脚本/编程的新手。 I want to create a menu that shows the following: list files, time and date, calendar, password file and exit. 我想创建一个显示以下内容的菜单:列表文件,时间和日期,日历,密码文件和退出。 User should be able to enter their choice and script responds. 用户应该能够输入他们的选择并且脚本响应。 Any help appreciated!! 任何帮助表示赞赏!

while ((choice 1=5))
do
   clear
   echo "1. List all files"; echo
   echo "2. Display date and time"; echo
   echo "3. Calendar"; echo
   echo "4. Passwd file"; echo
   echo "5. Exit"; echo
   echo -n "Enter choice"

   read choice
   case $choice in
   1) ls -l;;
   2) date;;
   3) cal;;
   4) cat /etc/passwd;;
   5) echo "Thanks and goodbye!";;
   *) echo "1..5 only"
   esac
   sleep 3
done

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM