rsh xterm and running remote commands
I'm stumped and hoping someone can provide an example or two.
I'd like to rsh (or ssh) into another machine on our network, open up an xterm displaying on my machine (and here's the tricky part), and then execute a command on the remote machine WITHOUT having to type it in the xterm, but rather somehow piping it into the rsh xterm command.
I've come this far:
rsh <remote_machine> xterm -display <my_machine>:0.0 -title TEST -geometry 72x12+0+0
This rshells into the <remote_machine>, and runs an xterm displaying on <my_machine>. However, I can't figure out how to run one or more commands ON that remote_machine so that they will display on <my_machine> on the open xterm, again WITHOUT having to manually type them into the xterm window.
I.e. How could I run a 'pwd' and 'ls' command on the remote_machine so that it would display the results on the xterm. I gather it should have something to do with piping in the 'pwd' and 'ls' to the rsh...xterm command line above, but I can't seem to find the right combination.
P.S. For now I'd be happy to just figure out the rsh method, but eventually my goal is to also do the above using passwordless ssh, but I can leave that for another day!