#!/bin/bash while true; do ./t > t.in ./a < t.in > a.out ./b < t.in > b.out diff a.out b.out > /dev/null if [ $? -ne 0 ]; then break; fi done 然后在终端内 sh dp.sh即可对拍