28 lines
400 B
Bash
28 lines
400 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
pass=true
|
||
|
out=""
|
||
|
regex='^You rolled a (1[0-2]|[1-9])$'
|
||
|
|
||
|
# figure out a way to test this more reliable
|
||
|
for i in {1..1}
|
||
|
do
|
||
|
sleep .15
|
||
|
program_out=$(./program)
|
||
|
if [[ "$program_out" =~ $regex ]]
|
||
|
then
|
||
|
out="$out\nPASS $program_out"
|
||
|
else
|
||
|
pass=false
|
||
|
out="$out\nFAIL $program_out"
|
||
|
fi
|
||
|
done
|
||
|
if("$pass" = true)
|
||
|
then
|
||
|
echo PASS
|
||
|
else
|
||
|
echo FAIL
|
||
|
fi
|
||
|
echo ""
|
||
|
echo -e $out
|