running command remotely to populate local variable

If I run this

[root@central-server] # ssh remote-server 'du -sk /usr/platform/`uname -i`/'
174     /usr/platform/SUNW,Sun-Fire-V245

I get my output just fine,

However, if i try to do the same but populate a local variable within my script called for example 'result'

#!/bin/ksh

result=`ssh remote-server 'du -sk /usr/platform/`uname -i`/'`
echo $result

I get

[root@central-server] # ./test.sh 
./test.sh[13]: /: cannot execute
./test.sh[13]: -i:  not found

It looks like the `uname -i` is not getting run remotely, does anybody know how I can get this to be recognised by the remote box ?

Any help would be great

Cheers

Use proper korn shell command substitution in the script.

# cat script
     #!/usr/bin/ksh
     result=$(ssh remote-client 'du -sk /usr/platform/`uname -i`')
     echo $result

# ./script
448 /usr/platform/FJSV,GPUZC-M
#

thankyou, i didnt know you could do that with the brackets ....is that ksh only ?

ps - works perfectly thanks

It probably works in bash and newer shells as well.