I have a variable named
choice. I want to prompt for inputting a value for
choice until it is non-empty and equal to either
In other words: While
choice is empty or different that
no then enter choice.
If I write it in Java it would be piece of cake with:
while (choice.IsEmpty() || (!choice.equals("yes") && !choice.equals("no"))
But I cannot find a way to translate it to
shell without using the content (var between double quotes) syntax:
while [ "$choice" != "yes" && "$choice" != "no" ]
Obviously it works, but, for my personal knowledge, is there another way to test that the same way as in Java?