LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 06-10-2004, 11:38 AM   #1
asciimonster
LQ Newbie
 
Registered: Mar 2004
Posts: 20

Rep: Reputation: 0
Unhappy Command-line paranoia: Converting a pipe to stdin


I'd like to pass some data between two programmes, lets say data X from programme A to programme B.

Now the only way to get data out of programme A is through a pipe:
~> ./A | B
But B expects the data to be in stdin:
~> ./B < X

So with
~> ./A | B
B processes no data and with
~> ./B < A
A doesn't get run

How do I fix this?
 
Old 06-10-2004, 03:19 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 63
Try redirecting 'A's output to stdin ie:
Code:
./A >&0 | B
 
Old 06-27-2004, 05:37 PM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 63
Did this work for you? I'm kind of curious...
 
Old 06-28-2004, 04:57 AM   #4
asciimonster
LQ Newbie
 
Registered: Mar 2004
Posts: 20

Original Poster
Rep: Reputation: 0
Erm. I must have had a blackout or something when I wrote this.

A simple
Code:
./A | B
was enough. I found out that the pipe WAS a connection between the std-out and std-in. And I was giving incorrect parameters to programme A, which caused it to print the error messages on std-err (i.e. the screen).

This
Code:
./A >&0 | B
Only made sure that the output of A got printed on the screen and not to B. But you can do this much simpler by:
Code:
A && B
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
metacharacters "The Pipe command mikeinanson Linux - Newbie 4 03-11-2006 12:36 PM
how to pipe and parse output of a command learnfast Linux - Newbie 2 06-15-2005 04:55 AM
how to: a pipe command? youngstorm Linux - Newbie 2 02-02-2005 10:52 AM
Pipe command question satimis Linux - Newbie 8 01-07-2004 10:54 AM
Converting a paragraph into a one-line string ganninu Linux - General 4 12-03-2003 07:50 AM


All times are GMT -5. The time now is 07:40 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration