Fork me on GitHub

如何通过脚本实现显示版本号、CPU、硬盘和内存条大小

COLOR="\033[1;$[RANDOM%7+31]m"     
COLOR1="\033[1;$[RANDOM%7+31]m"
COLOR2="\033[1;$[RANDOM%7+31]m"
COLOR3="\033[1;$[RANDOM%7+31]m"
COLOR4="\033[1;$[RANDOM%7+31]m"
COLOREND="\033[0m"
echo -e "OS Verion is $COLOR`cat /etc/redhat-release`\033[0m"
echo -e "kernel version is $COLOR1`uname -r`\033[0m"
echo -e "CPU type is $COLOR2`lscpu|grep 'Model name'|cut -d: -f2|tr -s ' '`\033[0m"
echo -e "Disk space is $COLOR3`lsblk|grep disk|tr -s ' '|cut -d ' ' -f4`\033[0m"
echo -e "Memory size is $COLOR4`free -h|grep Mem|tr -s ' ' |cut -d" " -f2`\033[0m"

 

posted @ 2019-11-04 15:30  Alex-Lzy  阅读(220)  评论(0编辑  收藏  举报