我正在尝试在后台运行两个脚本。但是,我想先运行一个脚本,等待它完成并递归运行下一个脚本。此代码片段会这样执行:
for i in "${studyinstanceuids[@]}"
do
#let count="$count+1"
echo "$i" | ./cmd2&
sleep 5
if job1 is alive then sleep 5
echo "$i" | ./sendExamToRepo.sh&
wait
fi
for i in "${studyinstanceuids[@]}"; do
( echo "$i" | ./cmd2; echo "$1" | ./sendExamToRepo.sh )&
done
wait