#!/bin/bash function get_pcie() { pcie="" pcie_result="successful" for NVME in `lspci | grep -i non-V | awk '{print $1}'` do s_pcie=`lspci -s $NVME -vvv | grep LnkSta: | awk '{print $3}'` if [ ! -n "$pcie" ]; then pcie=$s_pcie else if [ $pcie != $s_pcie ]; then pcie_result="failed" break fi fi done if [ $pcie_result == 'successful' ]; then echo $pcie else echo -e "\033[31m 设备速率标准不统一,请人为判断磁盘性能 \033[0m" fi } r_pcie=`get_pcie` echo -e "\033[32m 【开始NVME性能测试】($r_pcie) \033[0m" echo "【开始NVME性能测试】($r_p.... 磁盘压测 待分类