#!/usr/bin/env bash file=`mktemp` echo echo "Running test. Log file: $file." echo trap 'echo' SIGINT ./lambda4_test.out 2>&1 | tee $file | stdbuf -o0 grep -Po '(?<=measure=)[^ ]*' | stdbuf -o0 tr '\n' ' ' if [ $? -eq 0 ] then rm $file echo echo 'Test succeeded' else echo '' echo 'Test failed or interrupted' echo "Please have a look at log file: $file ." fi