Command pipe question

Questions from newcomers to the UNIX and Linux operating systems. All questions welcome, and you may find an expert here able to help.

Command pipe question

Postby atrxe » Wed Nov 15, 2006 11:24 pm

I am trying to pipe the output from cat to the command line, without much luck. I have a file named ipaddr which contains 192.168.1.20, and i want to send that to ssh so my "command" would be "ssh 192.168.1.20"
I've tried
ssh < cat ipaddr
cat ipaddr | ssh

What gives?


[/list]
atrxe
 
Posts: 2
Joined: Thu Nov 09, 2006 6:36 pm

Advertisement

pipe

Postby kjteoh » Fri Nov 17, 2006 1:46 pm

welp .. generally shows little understanding for how pipes work..

better is $ssh `cat ipaddr`

ps: your milege will vary
kjteoh
 
Posts: 20
Joined: Fri Jul 21, 2006 3:08 am

Thanks

Postby atrxe » Tue Nov 28, 2006 7:41 pm

Hey that works much better! Thank you.
And yes I have little understanding for how pipes work, hence the post to the "newbies" discussion.
atrxe
 
Posts: 2
Joined: Thu Nov 09, 2006 6:36 pm

pipes

Postby kjteoh » Wed Nov 29, 2006 11:18 am

Glad to be of service .. sorry if my last post sounded "offensive" ... was not meant to be and the try $cd /lib/modules/`uname -r` which is take you to the true modules dir. Works on Linux and its really a Shell thing thus "your milege will vary".

kjteoh

Thinking about it ... the short explanation why pipes wont work ... when you go $ssh -lmyuser_name | cat ipaddr.txt

ssh will "complete" its job followed by sending it to cat for example:-

$ssh -lmyuser_name | cat

in turn you will get replies "blah blah" generated by ssh command followed by the same "blah blah" generated by the cat command.
kjteoh
 
Posts: 20
Joined: Fri Jul 21, 2006 3:08 am


Return to Newbie questions

Who is online

Users browsing this forum: No registered users and 1 guest

cron