Answer the question
In order to leave comments, you need to log in
How to compare 2 numbers entered by the user?
Tell me how to compare 2 numbers entered by the user from the keyboard?
In this case, it does not work correctly. Please tell me how to correct the comparison.
./main.sh: line 10: [: -eq: unary operator expected
number=10
count=5
for i in `seq 1 $count`; do
echo "Input value: "
read $value
if [ $value -eq $number ]
then
echo "Win!!!"
exit
fi
done
Answer the question
In order to leave comments, you need to log in
read $value
read value
same, the name of the variable should be there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question