Update nodeloc_vps_autotest_ip.sh

This commit is contained in:
Jensfrank 2024-06-27 12:10:51 +08:00 committed by GitHub
parent 29a2d79a27
commit 68aaa8a18f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,22 +158,29 @@ run_all_tests() {
# 格式化结果为 Markdown # 格式化结果为 Markdown
format_results() { format_results() {
result="[tabs] # 转义特殊字符,但保留颜色代码
escaped_result=$(echo "$ip_quality_result" | sed 's/\\/\\\\/g; s/`/\\`/g; s/\$/\\$/g; s/\*/\\*/g; s/_/\\_/g')
result="[tabs]
[tab=\"IP质量\"] [tab=\"IP质量\"]
\`\`\` \`\`\`ansi
$ip_quality_result $escaped_result
\`\`\` \`\`\`
[/tab] [/tab]
[/tabs] [/tabs]
" "
echo "$result" | iconv -f UTF-8 -t UTF-8//IGNORE > results.md echo "$result" > results.md
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}" echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
} }
# 主函数 # 主函数
main() { main() {
install_dependencies if type install_dependencies &>/dev/null; then
show_welcome install_dependencies
fi
if type show_welcome &>/dev/null; then
show_welcome
fi
run_all_tests run_all_tests
echo -e "${GREEN}所有测试完成。结果已保存到 results.md 文件中。${NC}" echo -e "${GREEN}所有测试完成。结果已保存到 results.md 文件中。${NC}"
echo "最终结果文件内容:" >&2 echo "最终结果文件内容:" >&2