I am trying to use expect to automate my task of running commands on remote machines.

so,
when i do

spawn pid [command]

i get the pid.

Can some one tell me how do i get the return value from the spawned command ?

Many Thanks
Ravi