脚本:
#!/bin/bash
#
#*************************************************************
#Author: chen
#QQ: 2088346053
#Date: 2021-12-03
#FileName: disk.sh
#Description: The test script
#Copyright (C): 2021 All rights reserved
#*************************************************************
BEGIN="\e[1;32m"
END="\e[0m"
echo -e "${BEGIN}`df |grep '^/dev/sd' |grep -Eo '[0-9]+%'|grep -Eo '[0-9]+'|sort -nr|head -n1`${END}"
实例: