#!/bin/bash for f in $(cat torun.txt); do result=$(cargo run $f 2>&1 | tail -n 1 | awk '{print $NF}') if [[ $result != 0 ]]; then testnum=$(( result >> 1 )) echo $f: test $testnum failed exit 1 fi done echo all tests passed