[Next] [Up] [Previous] [Contents]
Next: Loops in scripts Up: Miscellaneous tips Previous: Terminal input in

Remote shell trick

Here is the proper syntax to use the rsh (remote shell) command without having the remote shell remain active until the remote command is completed.


    rsh machine -n 'command >&/dev/null </dev/null &'
where machine is the name of the remote computer and command is the remote command to be performed.

This works because the -n flag attaches the rsh's standard input to /dev/null so you can execute the complete rsh command in the background of the local computer. Also, the input/output redirections on the remote computer (the stuff inside the single quotes) makes rsh think the session can be terminated since there is no data flow. In all truth, you don't have to use /dev/null. Any filename will work.


c.c.taylor@ieee.org