Last active
August 29, 2015 14:16
-
-
Save ssugiyama/96f9583202ed3bd71fc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
max=100 | |
voices=(audrey sebastien thomas virginie) | |
while getopts n: OPT | |
do | |
case $OPT in | |
"n" ) max="$OPTARG" | |
esac | |
done | |
n=$(( (RANDOM % $max) + 1 )) | |
v=$((RANDOM % ${#voices[*]})) | |
text="ça coûte $n euros." | |
while [ -z "$ans" ] | |
do | |
say -v ${voices[$v]} $text | |
echo -n "> " | |
read ans | |
done | |
if [ $ans -eq $n ] | |
then | |
echo ok | |
else | |
echo $n | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment