Linux 下 Bash 脚本对拍

背会。。。

#!/bin/bash
i=0
while true ;do 
    ./maker > data.in
    ./a <data.in> data.out
    ./b <data.in> data.ans
    if diff data.out data.ans ;then
        printf "AC
"
    else printf "WA
" break;
    fi
done
对拍

 还有一个多组数据测试。

注意赋值的时候i前面不加$

#!/bin/bash
i=0
while [ $i -le 7 ]
do
    echo test $i
     ./a <a$i.in> a.out
    if diff a$i.ans a.out;then
        echo Ac 
    fi
    i=$(($i+1))
done
多组数据
原文地址:https://www.cnblogs.com/sdfzhsz/p/9786793.html