mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-12-27 00:35:19 +00:00
Update nodeloc_vps_autotest.sh
This commit is contained in:
parent
68aaa8a18f
commit
33a00e1e97
@ -3,6 +3,9 @@
|
|||||||
# 定义版本
|
# 定义版本
|
||||||
VERSION="1.0.0"
|
VERSION="1.0.0"
|
||||||
|
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
|
||||||
# 定义颜色
|
# 定义颜色
|
||||||
RED='\033[0;31m'
|
RED='\033[0;31m'
|
||||||
GREEN='\033[0;32m'
|
GREEN='\033[0;32m'
|
||||||
@ -129,11 +132,15 @@ show_welcome() {
|
|||||||
clear
|
clear
|
||||||
}
|
}
|
||||||
|
|
||||||
# 运行命令并捕获输出
|
# 定义一个数组来存储每个命令的输出
|
||||||
|
declare -a test_results
|
||||||
|
|
||||||
|
# 在每个命令执行后保存结果
|
||||||
run_and_capture() {
|
run_and_capture() {
|
||||||
local output
|
local command_output
|
||||||
output=$(eval "$1" 2>&1)
|
command_output=$(eval "$1" 2>&1)
|
||||||
echo "$output"
|
test_results+=("$command_output")
|
||||||
|
echo "$command_output"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 运行所有测试
|
# 运行所有测试
|
||||||
@ -242,23 +249,6 @@ $autotrace_result
|
|||||||
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
echo -e "${GREEN}结果已保存到 results.md 文件中。${NC}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# 复制结果到剪贴板
|
|
||||||
copy_to_clipboard() {
|
|
||||||
if [ -f results.md ]; then
|
|
||||||
if command -v xclip > /dev/null; then
|
|
||||||
xclip -selection clipboard < results.md
|
|
||||||
echo -e "${GREEN}结果已复制到剪贴板。${NC}"
|
|
||||||
elif command -v pbcopy > /dev/null; then
|
|
||||||
pbcopy < results.md
|
|
||||||
echo -e "${GREEN}结果已复制到剪贴板。${NC}"
|
|
||||||
else
|
|
||||||
echo -e "${RED}无法复制到剪贴板。请手动复制 results.md 文件内容。${NC}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "${RED}results.md 文件不存在。${NC}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# 主函数
|
# 主函数
|
||||||
main() {
|
main() {
|
||||||
install_dependencies
|
install_dependencies
|
||||||
@ -266,7 +256,6 @@ main() {
|
|||||||
run_all_tests
|
run_all_tests
|
||||||
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
echo -e "${GREEN}所有测试完成。点击屏幕任意位置复制结果。${NC}"
|
||||||
read -n 1 -s
|
read -n 1 -s
|
||||||
copy_to_clipboard
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main
|
main
|
||||||
|
Loading…
Reference in New Issue
Block a user