首页 > 代码库 > 简单shell 编程

简单shell 编程

简单shell编程  by  dreamboy

 1 #!/bin/bash 2 while true 3 do 4     echo  5     clear 6     echo  7     echo "        系统维护菜单        " 8     echo "============================ " 9     echo "      1)显示系统日期         "10     echo "      2)修改系统日期         "11     echo "      3)显示已登录用户       "12     echo "      4)重启电脑             "13     echo "      5)关机                 "14     echo "      6)退出                 "15     echo "============================ "16     echo "                            "17     echo -n "请选择:"18     read sel19     case ${sel} in20         1) date +"%Y-%m-%d %H:%M";;21         2) echo -n "请输入新的日期(MMDDhhmm[[CC]YY]):"22            read da23            date ${da};;24         3) who -u | awk {print $1};;25         4) shutdown -r now;;26         5) shutdown -h now;;27         6) break;;28     esac29     read30 done

 

简单shell 编程