#!/bin/bash cat <<EOF cpu)display cpu information mem)display mem information disk)display disk information quit)display quit information EOF while read -p "please input :" value do while [ $value != "cpu" -a $value != "mem" -a $value != "disk" -a $value != "quit" ] do read -p "please input 'cpu|mem|disk|quit' :" value done if [ "$value" == "cpu" ] then lscpu elif [ "$value" == "mem" ] then free -m elif [ "$value" == "disk" ] then fdisk -l /dev/[hs]d[a-z] elif [ "$value" == "quit" ] then exit 0 fi done