From 94e009e259d1a9dd00bae8da681f09b556afe752 Mon Sep 17 00:00:00 2001 From: xzx3344521 Date: Tue, 28 Oct 2025 14:07:55 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E6=B5=8B=E9=80=9F=E4=B8=AD=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 测速中文 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/测速中文 b/测速中文 index c1e0cc9..c4fa68e 100644 --- a/测速中文 +++ b/测速中文 @@ -1,12 +1,15 @@ #!/bin/bash -echo "🌐 开始测速..." -{ - curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 - --simple -} 2>/dev/null | while IFS= read -r line; do - case $line in - *Ping:*) echo "🔄 延迟: ${line#*:}" ;; - *Download:*) echo "⬇️ 下载: ${line#*:}" ;; - *Upload:*) echo "⬆️ 上传: ${line#*:}" ;; - esac -done -echo "✅ 完成" +echo "🚀 一键网络测速" + +# 下载并运行官方 Speedtest +result=$(wget -q -O- https://install.speedtest.net/app/cli/ookla-speedtest-1.2.0-linux-x86_64.tgz | tar xz && ./speedtest --simple) + +# 显示中文结果 +echo "$result" | awk ' +/Ping:/ {printf "🔄 网络延迟: %s %s\n", $2, $3} +/Download:/ {printf "⬇️ 下载速度: %s %s\n", $2, $3} +/Upload:/ {printf "⬆️ 上传速度: %s %s\n", $2, $3} +' + +# 清理文件 +rm -f speedtest