背会。。。
#!/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