On Stdio... - GNU/Linux

Users browsing this thread: 1 Guest(s)
movq
Long time nixers
Are you referring to pipes? Something like this?

Code:
$ ./first_script.sh | grep something | ./second_script.pl

Here's an extremely short rundown.

When a process starts (be it a script or not), it is usually preconnected with three file descriptors: STDIN, STDOUT, STDERR. The process can use these FDs as if they were regular files. Unless your program is an interactive one (like an editor), it doesn't matter if these file descriptors point to actual files or "devices" like a terminal. When you build a pipeline like `foo | bar`, STDOUT of `foo` is fed into STDIN of `bar` by means of a pipe. `bar` then just reads from its STDIN and it just works.

Now, I vaguely remember that somebody already posted a detailed article about files, file descriptors, pipes, and similar concepts. I just can't find it anymore. :-)

I/we can elaborate more on that topic if you like. In the meantime, the following articles on Wikipedia might help you as well:

https://en.wikipedia.org/wiki/Standard_streams
https://en.wikipedia.org/wiki/Pipeline_(Unix)


Messages In This Thread
On Stdio... - by NetherOrb - 05-11-2016, 09:02 PM
RE: On Stdio... - by movq - 06-11-2016, 10:14 AM
RE: On Stdio... - by pranomostro - 06-11-2016, 02:48 PM
RE: On Stdio... - by movq - 06-11-2016, 05:14 PM
RE: On Stdio... - by pranomostro - 06-11-2016, 07:24 PM
RE: On Stdio... - by NetherOrb - 06-11-2016, 11:28 PM
RE: On Stdio... - by apk - 07-11-2016, 12:13 AM
RE: On Stdio... - by NetherOrb - 07-11-2016, 12:21 AM
RE: On Stdio... - by venam - 07-11-2016, 01:49 AM
RE: On Stdio... - by jkl - 07-11-2016, 04:26 AM
RE: On Stdio... - by pranomostro - 07-11-2016, 07:26 AM
RE: On Stdio... - by z3bra - 07-11-2016, 08:57 AM
RE: On Stdio... - by jkl - 07-11-2016, 11:28 AM
RE: On Stdio... - by pranomostro - 07-11-2016, 12:43 PM
RE: On Stdio... - by jkl - 07-11-2016, 12:47 PM
RE: On Stdio... - by pranomostro - 07-11-2016, 01:28 PM
RE: On Stdio... - by jkl - 07-11-2016, 01:30 PM
RE: On Stdio... - by venam - 07-11-2016, 01:36 PM
RE: On Stdio... - by pranomostro - 07-11-2016, 02:43 PM
RE: On Stdio... - by jkl - 07-11-2016, 02:45 PM