#!/bin/bash
#
cat << EOF
cpu) show cpu information;
mem) show memory information;
disk) show disk information;
quit) quit
#############################################################
EOF

read -p "Enter a option:" option
while [ "$option" != 'cpu' -a "$option" != 'mem' -a "$option" != 'disk' -a "option" != 'quit' ];do
  read -p "Wrong option,please Enter again:" option
done

if [ "$option" == 'cpu' ];then
  lscpu
elif [ "$option" == 'mem' ];then
  cat /proc/meminfo
elif [ "$option" == 'disk' ];then
  fdisk -l
else
  echo "Quit"
  exit 0
fi
~      

  

相关文章:

  • 2021-05-22
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-01-01
  • 2021-06-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案