#!/bin/bash apt install -y docker-compose # 指定要检查的文件路径 file_path="./test_script/finished" rm -rf file_path docker compose up & # 使用 while 循环不断检查文件是否存在 while true; do if [ -e "$file_path" ]; then echo "文件 $file_path 已存在,退出循环。" break else echo "文件 $file_path 不存在,继续检查..." fi sleep 1 # 等待 1 秒 done docker compose down echo "继续测试"