Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.networking > #2065
| From | Chris Davies <chris-usenet@roaima.co.uk> |
|---|---|
| Newsgroups | comp.os.linux.networking, comp.os.linux.misc |
| Subject | Re: Mental-model of multiprocessing? |
| Date | 2013-03-29 17:31 +0000 |
| Organization | Roaima. Harrogate, North Yorkshire, UK |
| Message-ID | <rovg2ax8ap.ln2@news.roaima.co.uk> (permalink) |
| References | <kiuu67$4lv$1@dont-email.me> <kj48dn$iec$1@dont-email.me> |
Cross-posted to 2 groups.
In comp.os.linux.networking Avoid9Pdf@gmail.com wrote:
> How does the shell morph the syntax of `cat`?!
> This looks like FRAUD!! Where's the FBI?
It doesn't morph cat's syntax. You've maybe got an invalid mental model,
though.
Start with stdin "standard input" and stdout "standard output". Usually
the keyboard provides stdin (on file descriptor 0) and the screen/terminal
accepts stdout from file descriptor 1. There's also stderr on file
descriptor 2, but I'm going to ignore that.
All the default assignments can be changed with the < and > modifiers;
these work respectively on file descriptor 0 (stdin) and 1 (stdout)
unless you explicitly state otherwise.
Every standalone command is initially attached to stdin and stdout. The
"|" pipe symbol attaches the stdout from its left-hand side to the stdin
of the right-hand side. Brackets "(..)" group commands together into a
single unit.
The cat command is defined to concatentate one or more files provided
as command line parameters, or stdin if none is provided. It writes the
result to stdout.
Using these simplified rules you can see that this next command line
takes the stdout from echo and writes to the stdin of cat. Cat is defined
to send its inputs to stdout, and that isn't redirected anywhere so it
appears on your terminal.
echo "hello, world" | cat
Easy really.
Chris
Back to comp.os.linux.networking | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-27 11:13 +0000
Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-03-27 14:02 +0000
Re: Mental-model of multiprocessing? Richard Kettlewell <rjk@greenend.org.uk> - 2013-03-27 14:13 +0000
Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 14:35 +0000
Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-27 15:30 +0000
Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 18:57 +0000
Re: Mental-model of multiprocessing? Richard Kettlewell <rjk@greenend.org.uk> - 2013-03-27 21:15 +0000
Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-27 21:36 +0000
Re: Mental-model of multiprocessing? Aragorn <stryder@telenet.be.invalid> - 2013-03-28 06:56 +0100
Re: Mental-model of multiprocessing? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2013-03-27 21:47 +0000
Re: Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-29 14:28 +0000
Re: Mental-model of multiprocessing? The Natural Philosopher <tnp@invalid.invalid> - 2013-03-29 15:32 +0000
Re: Mental-model of multiprocessing? J G Miller <miller@yoyo.ORG> - 2013-03-29 22:36 +0000
Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-29 17:31 +0000
Re: Mental-model of multiprocessing? Avoid9Pdf@gmail.com - 2013-03-29 21:10 +0000
Re: Mental-model of multiprocessing? "Chris F.A. Johnson" <cfajohnson@gmail.com> - 2013-03-29 18:55 -0400
Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-03-30 06:01 +0000
Re: Mental-model of multiprocessing? Chris Davies <chris-usenet@roaima.co.uk> - 2013-03-30 21:28 +0000
Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-04-01 15:32 +0000
Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-04-03 08:00 +0000
Re: Mental-model of multiprocessing? Joe Beanfish <joebeanfish@nospam.duh> - 2013-04-08 14:47 +0000
Re: Mental-model of multiprocessing? Unknown <dog@gmail.com> - 2013-04-03 08:02 +0000
csiph-web