LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-07-2012, 12:43 PM   #1
CarT_0x41414141
LQ Newbie
 
Registered: Jun 2012
Posts: 1

Rep: Reputation: Disabled
When does a PIPE open the next process?


When does a linux pipe open the next program in the command...

Example command #1
python -c 'raw_input(); print "AAAA"' | netcat localhost 31337

What is the long version of a pipe '|' ?
defclare new fd xyz
command1 1>&xyz; run commdand < &xyz ?

Thanks in advance
 
Old 06-07-2012, 03:57 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by CarT_0x41414141 View Post
When does a linux pipe open the next program in the command...

Example command #1
python -c 'raw_input(); print "AAAA"' | netcat localhost 31337
AFAIK, the shell first creates a pipe, then creates the two processes (python and netstat) nearly simultaneously, passes the write end of the pipe to the first process (python), and the read end to the second process (netstat). So the two programs run concurrently at the same time, output of one becoming input of the other.

Quote:
Originally Posted by CarT_0x41414141 View Post
What is the long version of a pipe '|' ?
I'm not sure I understand the question. And I don't know much of python. Almost nothing, to be honest.
Anyway, the strategy must be:
  1. open a pipe
  2. create the first process, passing it the pipe's file descriptor as stdout
  3. create the second process, passing it the pipe's file descriptor as stdin
This is abstract enough to be appropriate to nearly any language that offers functions for process control.

[X] Doc CPU
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kill a process using pipe Hi_This_is_Dev Linux - General 12 06-08-2011 09:03 AM
Getting the name of the process that sent data to a pipe? (bash) KaosX Programming 3 02-17-2011 09:27 AM
Can't connect to pipe process addr1 Arch 0 12-14-2008 06:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:52 AM.

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