I am trying to create a script which quizzes users on language vocabulary.
Here it is so far:
while read line
do
trans -s es -brief "$line"
read -r answer < /dev/tty
echo -en "\e[2A"; echo -e "\e[0K\r$line"
say -v Jorge "$line"
if ["$answer" == "$line"]; then
echo -en "\e[1A"; echo -e "\e[0K\rcorrect"
else
echo -en "\e[1A"; echo -e "\e[0K\rwrong"
fi
done
and when run (the file passed via stdin can look like this):
No matter what I enter, for some reason bash is printing wrong
even though it should be correct.