LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-04-2016, 12:49 AM   #16
trendal
LQ Newbie
 
Registered: Jul 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled

Now that you repeat yourself it sinks in.
 
Old 07-04-2016, 12:52 AM   #17
trendal
LQ Newbie
 
Registered: Jul 2016
Posts: 10

Original Poster
Rep: Reputation: Disabled
That jimmyg.org site just got bookmarked.

https://jimmyg.org/blog/2009/working...ined-pipelines
 
Old 07-04-2016, 01:56 AM   #18
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,307
Blog Entries: 3

Rep: Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721Reputation: 3721
I think once you see the separate parts, you'll understand it quite well. You might try the pipes in #10 above again.

Quote:
Originally Posted by trendal View Post
In a terminal I tried this:
Code:
cat route-cost.sh | ssh username@10.1.1.19
It runs on the remote machine ...
The "cat" part runs on the local machine, via the terminal. The "ssh" part runs on the local machine, too, but as you have it without anything after the username + host, it will just run a shell on the remote machine. The pipe is not a parameter, it connects the two so that the output from "cat" becomes the input for "ssh"

If you use "cat" a second time, but over on the remote machine instead of the local one, then you can use it to capture the incoming text with the help of a redirect. Here, "ssh" is used to run "cat" with a redirect. The redirect captures the output "cat" but "ssh" provides input to "cat" which it gets from the output of the first "cat" via the pipe.

Code:
cat route-cost.sh | ssh username@10.1.1.19 "cat > owhereami.txt"
Which machine did "owhereami.txt" end up on and what are its contents?
 
1 members found this post helpful.
  


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
[SOLVED] SSH remote command: Pipe remote output to local machine? kenneho Linux - Server 6 12-06-2012 01:37 AM
ssh - using variables in call to start remote script from local script babag Linux - Networking 2 06-03-2008 04:50 PM
bash - start remote script from local script? babag Programming 7 04-06-2008 05:46 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 10:00 AM
shell script to compare filese b/w local and remote and delete files from local serve dsids Linux - Networking 9 08-23-2006 07:20 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:56 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