I am very new to shell scripting, and i have had this error. I am using a while loop that goes a bit like this:
while [ "$variable" =! "hello" -o "$variable" =! "hi" ]
do
echo "variable isn't hi or hello"
done
but shell then gives the error [: too many arguments
!=instead of=!(and you also want to use-ainstead of-o)-avs-o, see "Why non-equality check of one variable against many values always returns true?" Also, both-aand-ocan lead to parsing ambiguities; I'd recommend[ "$variable" != "hello" ] && [ "$variable" != "hi" ]instead.casestatement.case $variable in hello|hi) :;; *) echo "variable isn't hi or hello";; esac[ "$variable" != "hello" ] && [ "$variable" != "hi" ]and it worked