simple (I think) question about using ssh
Hi, I want the output of one program executed on another computer that I'm logged into via ssh.
For example, I have a program foo running on machine B that generates some commands that I need execute on machine A. It doesn't generate the output all at once, so I can't just dump the output to a file and redirect that file into the input of ssh. I thought that perhaps something like ssh machine | foo would work, but it doesn't seem to be. I tried it with a simple test where foo was the script echo "touch Afile" and then ran ssh machine | foo but all that happened was "touch Afile" showed up on my screen as soon as I pressed enter. Is there an easier way to do this? |
umm, I'm not sure what you were expecting to happen.
Do you have certificates set up for automatic login? Otherwise your login is going to get tangled up in the pipe. And foo doesn't take or use any input. It might be interesting to pipe it to tee and have that call foo. It won't do what you want, but it might show you more output. If you set up certificates and then pass the command you want run with the ssh, then you can get the output and use it. There is an example in this thread: http://www.linuxquestions.org/questi...ht=ssh+command basically, $ ssh user@server.domain "command" 2>&1 | foo or pipe to a file and then process the file. " | tee -a filename" shows the output of the script and also appends it to the file. Subsequent commands can then process what's in the file. |
All times are GMT -5. The time now is 04:23 AM. |