if statement remotely

I need to rsh to many machines and run an " if statement' that checks the versions of the OS and if up to date it tee -a to a file called "uptodate"..then if not update, it tee -a to file called "notuptodate" on my machine

the command that checks the version is cat /etc/version.
now the output of that is the one I am looking to have the if statement test against.

I am just having issues with setting up that if statement
This is part of it..( variable are already set up )

for host in `cat $SUN`
do
rsh $host "( /usr/bin/cat /etc/version)"

*problem starts here
if [$? = 5.8]; then
echo $host | tee -a $uptodate
else
echo $host | tee -a $notuptodate
fi
done

Your help would be appreciated

Hmm. You're testing the value of $? which is the exit code of the command - this is never going to be equal to 5.8

Something like
version=`rsh $host "( /usr/bin/cat /etc/version)"`
if [ "$version" -eq "5.8" ]; then
# version 5.8
else
# some other version
fi
# etc

might do it - this is untested though

Cheers
ZB