通过sh脚本 将输出重定向到自定义名称的多个文件

test.sh 内容如下:

output_files=("test1 .txt" "test2.txt" "test3.txt" "test4.txt" "test5.txt")  # 定义输出文件列表

for client_nums in 14 15 16
do
    python test.py > "output_file_$index.txt" 2>&1 &  # 更新了输出文件的命名方式
    index=$((index+1))  # 更新索引
done

运行:

 bash test.sh 

 

posted @ 2024-03-23 14:23  七三七3  阅读(8)  评论(0编辑  收藏  举报