mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-12-27 00:35:19 +00:00
Update nodeloc_vps_autotest_ip.sh
This commit is contained in:
parent
ba874788aa
commit
ab47a37c56
@ -130,13 +130,13 @@ show_welcome() {
|
||||
}
|
||||
|
||||
# 定义一个数组来存储每个命令的输出
|
||||
declare -a command_outputs
|
||||
declare -a test_results
|
||||
|
||||
# 在每个命令执行后保存结果
|
||||
run_and_capture() {
|
||||
local command_output
|
||||
command_output=$(eval "$1" 2>&1)
|
||||
command_outputs+=("$command_output")
|
||||
test_results+=("$command_output")
|
||||
echo "$command_output"
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ run_all_tests() {
|
||||
|
||||
# IP质量
|
||||
echo -e "运行${YELLOW}IP质量测试...${NC}"
|
||||
ip_quality_result=$(run_and_capture "bash <(curl -Ls IP.Check.Place)")
|
||||
run_and_capture "bash <(curl -Ls IP.Check.Place)"
|
||||
|
||||
# 格式化结果
|
||||
echo -e "${YELLOW}此报告由Nodeloc_VPS_自动脚本测试生成...${NC}"
|
||||
@ -155,12 +155,16 @@ run_all_tests() {
|
||||
|
||||
# 格式化结果为 Markdown
|
||||
format_results() {
|
||||
result="[tabs]
|
||||
[tab=\"IP质量\"]
|
||||
\`\`\`
|
||||
$ip_quality_result
|
||||
\`\`\`
|
||||
[/tab]
|
||||
result="[tabs]\n"
|
||||
|
||||
# IP质量测试结果
|
||||
result+="[tab=\"IP质量\"]\n\`\`\`\n${test_results[0]}\n\`\`\`\n[/tab]\n"
|
||||
|
||||
# 添加其他测试结果
|
||||
# 例如:
|
||||
# result+="[tab=\"Yabs\"]\n\`\`\`\n${test_results[1]}\n\`\`\`\n[/tab]\n"
|
||||
|
||||
result+="[/tabs]"
|
||||
|
||||
echo "$result" > results.md
|
||||
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
||||
@ -188,10 +192,9 @@ main() {
|
||||
install_dependencies
|
||||
show_welcome
|
||||
run_all_tests
|
||||
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
||||
echo -e "${GREEN}所有测试完成。结果已保存到 results.md 文件中。${NC}"
|
||||
echo "最终结果文件内容:" >&2
|
||||
cat results.md >&2
|
||||
read -n 1 -s
|
||||
copy_to_clipboard
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user