Skip to content

Instantly share code, notes, and snippets.

@ssugiyama
Last active August 29, 2015 14:16
Show Gist options
  • Save ssugiyama/96f9583202ed3bd71fc1 to your computer and use it in GitHub Desktop.
Save ssugiyama/96f9583202ed3bd71fc1 to your computer and use it in GitHub Desktop.
#! /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