#!/bin/bash bash stop.sh sleep 1s for env in a b c; do # 启动screen screen_name="screen_$env" screen -dmS $screen_name # 构造日志名 log="log_$env.log" # 使用go run 重定向日志 screen -S $screen_name -X stuff "go run main.go -etc $env >> $log 2>&1\n" done