菜單功能,執行顯示bash
#!/bin/bash
#菜單選擇功能,執行命令
while true #無限循環
do
clear
echo '-----------------------------'
echo '1.Display Cpu INFO:'
echo '2.Display system load:'
echo '3.Display Mem and swap INFO:'
echo '4.Display filesystem INFO:'
echo '5.exit program:'
echo '-------------------------------'
read -p 'please select an iterm(1-5):' u_selectless
case $u_select in 1)it
echo $(cat /proc/cupinfo)
read -p 'pless enter to continue:'
;;
2)
echo $(uptime)
read -p 'pless enter to continue:'
;;file
3)
echo $(free)
read -p 'pless enter to continue:'
;;
4)
echo $(df -h)
read -p 'pless enter to continue:'
;;
5)
exit
;;
*)
read -p 'pless selsct 1-5 ,pless enter to continue:'
esac
doneselect
=================================循環
while 批量添加用戶im
#!/bin/bash
#批量添加用戶
u=1
while [ $u -le 2 ]
do
useradd user$u
u=$((u+1))
done filesystem