The code is correct except that you have not declared the "Eugene" variable.
Hence its not able to compare the to variables so it might be throwing the error.
please use the below code:
#!/bin/bash
echo "What is your name"
read NAME
Eugene=Vicky
if [ $NAME -eq $Eugene ]; then
echo "My name is the same"
else
echo "You have a nice name"
fi
probably this would work. Please post the error if any....
#!/bin/bash
echo "What is your name"
read NAME
Eugene=Vicky
if [ "$NAME" = "$Eugene" ]; then
echo "My name is the same"
else
echo "You have a nice name"
fi
exit 0
Yes, that's because the variable Eugene is undefined or empty. You can put double quotes around the value to guard against this, or simply make sure it's always non-empty.
You should double-quote $NAME also, in case it's empty or contains special characters. In fact, always double-quote your variables.
It works sort of. It skips the line "My name is the same"
Basically this should get an input from the user, if the name is the same as mine it should say "My name is the same" if it isn't it should say "You have a nice name"
As of now any name i put it echo's "You have a nice name"