答案 0 :(得分:1)
-eq
is for numeric comparisons and all of the strings YES
, Y
, N
and NO
evaluate to zero. Hence they'll all match each other.
You should be using =
rather than -eq
.
However, you can also use regular expressions in bash
with something like:
[[ $input =~ [Yy] ]]
That seems much more readable to me.