简单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 sel 19 case ${sel} in 20 1) date +"%Y-%m-%d %H:%M";; 21 2) echo -n "请输入新的日期(MMDDhhmm[[CC]YY]):" 22 read da 23 date ${da};; 24 3) who -u | awk ‘{print $1}‘;; 25 4) shutdown -r now;; 26 5) shutdown -h now;; 27 6) break;; 28 esac 29 read 30 done
时间: 2024-10-14 04:01:29