LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-27-2008, 02:23 PM   #1
joe2748
Member
 
Registered: Nov 2007
Distribution: Ubuntu 9.10
Posts: 36

Rep: Reputation: 15
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?
 
Old 07-27-2008, 03:39 PM   #2
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
simple question, but about Windows SSH RevenantSeraph Linux - Networking 3 04-18-2007 07:45 PM
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
Simple ssh help. Optimistic Linux - Networking 4 02-18-2005 01:20 AM
Installing Programs - A simple question from my simple mind jmp875 Linux - Newbie 6 02-18-2004 09:03 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration