Update 测速中文

This commit is contained in:
2025-10-28 14:02:09 +08:00
committed by GitHub
parent de1cc8a129
commit ac115ae8c2

View File

@@ -1,19 +1,12 @@
#!/bin/bash #!/bin/bash
echo "🌐 网络速度测试" echo "🌐 开始测速..."
echo "正在启动..." {
curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 - --simple
# 直接运行测速,不下载文件 } 2>/dev/null | while IFS= read -r line; do
result=$(curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python3 - --simple 2>/dev/null) case $line in
*Ping:*) echo "🔄 延迟: ${line#*:}" ;;
if [ $? -ne 0 ] || [ -z "$result" ]; then *Download:*) echo "⬇️ 下载: ${line#*:}" ;;
echo "❌ 测速失败,请检查网络连接" *Upload:*) echo "⬆️ 上传: ${line#*:}" ;;
exit 1 esac
fi done
echo "✅ 完成"
# 快速解析结果
echo "✅ 测试完成:"
echo "$result" | awk '
/Ping:/ {printf "🔄 延迟: %s %s\n", $2, $3}
/Download:/ {printf "⬇️ 下载: %s %s\n", $2, $3}
/Upload:/ {printf "⬆️ 上传: %s %s\n", $2, $3}
'