Can't remote run the scripts through SSH

view story

http://www.linuxquestions.org – I have two machine A and B. Both machines run on the Redhat Enterprise 5.8. I have a script named test.sh on the machine B. The directory of the script is /root/Desktop/test.sh. The script contain a while loop to listen the serial port message. I need to use machine A to execute the scripts on the machine B using root account. Thus, I use the command [ssh machineB /root/Desktop/test.sh]. The script hangs on the machine A because of the while loop. Thus, I use the command [ssh machineB /root/Desktop/test.sh &]. However, the process appears on the machine A. How to solve it? (HowTos)