Skip to content

Instantly share code, notes, and snippets.

@xdamman
Created August 25, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xdamman/6d7c3efc01797cdb60719fcd3af0417c to your computer and use it in GitHub Desktop.
Save xdamman/6d7c3efc01797cdb60719fcd3af0417c to your computer and use it in GitHub Desktop.
Simple program to add two numbers and say them for my 5 y/o daughter.
run() {
Q1="Enter a first number:"
echo $Q1
say $Q1
read A
say $A
Q2="Enter a second number $1:"
echo $Q2
say $Q2
read B
say $B
RES=$(($A+$B))
echo "Result:"
ANSWER="$A + $B = $RES"
echo $ANSWER
say $ANSWER
say "Did you know that $1?"
sleep 1
echo ""
say "Play again!"
run $1
}
Q1="What is your name?"
echo $Q1
say $Q1
read NAME
A1="Nice to meet you $NAME!"
echo $A1
say $A1
echo ""
run $NAME
@madprog
Copy link

madprog commented Aug 25, 2018

I had to prepend this to make it work on Linux:

say() {
    espeak "$*" >/dev/null 2>&1
}

And install http://espeak.sourceforge.net/ (apt-get install espeak or pacman install espeak or ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment