Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@madprog 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