I cant for the life of me figure out why the second function is not working. I have tried using else and elif but i either get a syntax error or my second function does not show. This is just a simple bash script. Please, i need to know what i am doing wrong..
function yes() {
echo "Good boy"
}
function no() {
echo "Bad Boy"
}
echo " Did you eat this pillow? [y,n]" ; tput sgr0
read $answer
if [ "$answer" != "y" ];
then
yes
elif [ "$answer" != "n" ];
then
no
else
exit
fi
read $answertoread answer.readmust be a variable name. Inread answer, "answer" is a name. Inread $answer,$answeris the value of the variable named "answer".