Why am I getting "test: too many arguments" in my linux shell script when comparing strings for equality?


Ok. I have the following code:

RESULT = "Debbie Jones"

if test $RESULT = "Debbie Jones"
then
echo "Match!"
fi

When I run the script, I get test.sh: line 36: test: too many arguments

Why do I have too many arguments? I'm trying to test the string for equality.
davysouthernboyAsked:
Who is Participating?
 
woolmilkporcCommented:
Hi again,

RESULT="Debbie Jones"

(without spaces) and

if test "$RESULT" = "Debbie Jones" ...

(with quotes).

wmp
0
 
davysouthernboyAuthor Commented:
Thank you. :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.