When the variable $favSport is passed in this script to the if statement it works unless the variable contains 2 words
Hi all my son is teaching himself to program (I am technical but not a programmer). He is using bash scripts to learn the concepts of variables and loops. He is 6 so sorry if this code/problem is simple in nature.
He is doing OK and was quite proud of himself but big sisters being big sisters has managed to break his new toy and found a bug in his program he can't figure out. When the script runs and the user gets to the favourite sport section if the variable is 2 words
read -p "So $name what is your favourite sport? " favSport
if [ $favSport == football ] || [ $favSport == soccer ] || [ $favSport == Football ] || [ $favSport == Soccer ]
then
echo
echo I like $favSport too!!
else
echo
echo Oh I do not like $favSport. My favourite sport is football.
fi
error line 31: [: too many arguments
occurs but the program continues after that. Line 31 is the if statement