Test - too many arguments

How do I prevent the message "too many arguments" to appear when using this script?

name="one two three four five six seven"
if test $name=""
then
echo "Empty variable"
else
echo "Value assigned"
fi

output:
bash: test: too many arguments
Value assigned

Quote the variable and try..

if test "$name"=""
1 Like

WOW, nice!