ksh-script "arithmetic syntax error" comparing strings

Hi all,

I�ve already searched the forum but can�t find what i am doing wrong.
I am trying to compare two variables using ksh under red hat. The error I get is:

-ksh: .[123]: [: 75e245dfe25b753cfd69987a314adfe7: arithmetic syntax error

Below are the lines of the script, line 123 is the if-line, MDA and MDB values are correct, near the brackets there is only one space:

MDA=`md5sum /tmp/ftp_dir_after_transfer | cut -d' ' -f1 `
MDB=`md5sum /tmp/ftp_dir_before_transfer | cut -d' ' -f1 `
if [ $MDA -eq $MDB ];
then
echo "wrong" 
 else
echo "correct" 
fi

Thanks for your support
old_mike

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

Hi.

-eq is used for arithmetic comparisons.

String comparisons should be made using =

From the man page (man test):

       STRING1 = STRING2
              the strings are equal

       INTEGER1 -eq INTEGER2
              INTEGER1 is equal to INTEGER2

Hi scottn,

thank�s a lot, it works. The test man page is exactly what I was looking for.

old_mike