I am working on a small homework assignment that is asking me to write a script that asks for four words, and a user must type it exactly as it is echo.
My issue is that in my output, it is not giving me an echo for false statements. Everything I put in my if is true, and gives me the first approved echo statement. Is there an issue with the setting of variables, or the brackets and parenthesis? I've been trying to put them in all sorts of different variations throughout the if portion, but can't seem to get it to kick the false output. I also use shell check as my syntax check source, and it is showing the script as being functional. Any help would be appreciated, here is what I have written.
#!/bin/bash
varname1=even
varname2=odd
varname3=zero
varname4=negative
# Ask the user for one of four select words
echo "Type one of the following words:"
echo "even, odd, zero, negative"
read varword
if [[ ("$varword" -eq $varname1 ) || ("$varword" -eq $varname2 ) || ("$varword" -eq $varname3 ) || ("$varword" -eq $varname4 ) ]]
then
echo "The approved word you have selected is $varword ."
else
echo "The unapproved word you have selected is $varword . Please try again."
fi