mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-11-10 10:05:18 +00:00
Update nodeloc_vps_autotest_speed.sh
This commit is contained in:
parent
43f0e62b88
commit
2f82ab1140
@ -109,7 +109,7 @@ run_and_capture() {
|
||||
echo "$command_output"
|
||||
}
|
||||
|
||||
# 去除三网测速板块板块ANSI转义码并截取(多线程)
|
||||
# 去除三网测速板块ANSI转义码并截取(多线程)
|
||||
speedtest_multi_process_output() {
|
||||
local input="$1"
|
||||
# Step 1: 去除 ANSI 转义码
|
||||
@ -118,24 +118,24 @@ speedtest_multi_process_output() {
|
||||
|
||||
# Step 2: 计算关键字出现的次数
|
||||
local count
|
||||
count=$(echo "$no_ansi" | grep -c "大陆三网+教育网 IPv4 多线程测速")
|
||||
count=$(echo "$no_ansi" | grep -Fc "大陆三网+教育网 IPv4 多线程测速")
|
||||
|
||||
# Step 3: 提取所需的测试结果并过滤进度条
|
||||
local speedtest_multi_process_output_result
|
||||
speedtest_multi_process_output_result=$(echo "$no_ansi" | awk -v count="$count" '
|
||||
/大陆三网\+教育网 IPv4 多线程测速/ {
|
||||
speedtest_multi_process_output_result=$(echo "$no_ansi" | awk -v count="$count" -v key="大陆三网+教育网 IPv4 多线程测速" '
|
||||
$0 == key {
|
||||
if (--count == 0) {
|
||||
f=1; next
|
||||
}
|
||||
}
|
||||
f && !/测试进行中/ && !/^\s*$/;
|
||||
f && !/测试进行中/ && NF;
|
||||
/系统时间:/ {exit}
|
||||
')
|
||||
|
||||
echo "$speedtest_multi_process_output_result"
|
||||
}
|
||||
|
||||
# 去除三网测速板块板块ANSI转义码并截取(单线程)
|
||||
# 去除三网测速板块ANSI转义码并截取(单线程)
|
||||
speedtest_single_process_output() {
|
||||
local input="$1"
|
||||
# Step 1: 去除 ANSI 转义码
|
||||
@ -144,17 +144,17 @@ speedtest_single_process_output() {
|
||||
|
||||
# Step 2: 计算关键字出现的次数
|
||||
local count
|
||||
count=$(echo "$no_ansi" | grep -c "大陆三网+教育网 IPv4 单线程测速")
|
||||
count=$(echo "$no_ansi" | grep -Fc "大陆三网+教育网 IPv4 单线程测速")
|
||||
|
||||
# Step 3: 提取所需的测试结果并过滤进度条
|
||||
local speedtest_single_process_output_result
|
||||
speedtest_single_process_output_result=$(echo "$no_ansi" | awk -v count="$count" '
|
||||
/大陆三网\+教育网 IPv4 单线程测速/ {
|
||||
speedtest_single_process_output_result=$(echo "$no_ansi" | awk -v count="$count" -v key="大陆三网+教育网 IPv4 单线程测速" '
|
||||
$0 == key {
|
||||
if (--count == 0) {
|
||||
f=1; next
|
||||
}
|
||||
}
|
||||
f && !/测试进行中/ && !/^\s*$/;
|
||||
f && !/测试进行中/ && NF;
|
||||
/系统时间:/ {exit}
|
||||
')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user