Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.networking > #2071
| 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-30 21:28 +0000 |
| Organization | Roaima. Harrogate, North Yorkshire, UK |
| Message-ID | <302k2ax6kq.ln2@news.roaima.co.uk> (permalink) |
| References | <rovg2ax8ap.ln2@news.roaima.co.uk> <kj500f$qll$1@dont-email.me> |
Cross-posted to 2 groups.
In comp.os.linux.misc Avoid9Pdf@gmail.com wrote: > Which you would never write [nor echo "hello" | cat | cat | cat ] As CFAJ mentioned, this would work. Follow the (simplified) set of rules I gave you and you'll see that they apply: the "hello" is written the first cat, which writes to the second, which writes to the third. That final cat writes to the terminal because no other output target has been specified. > So then: > cat>/tmp/mesgFile > ( > read line 0<&3 ; echo "$line">$log > case "$line" in 2*) ;; *) echo "QUIT" 1>&3 ; exit 0 ;; esac > echo "HELO $local_name" 1>&3 > ) 3<>/dev/tcp/$smtp_server/25 > would mean > "stdin [since none is provided]" writeTo /tmp/mesgFile > the sequential output of the bracketed-statements > [which also write to there OWN destinations] > .... ?? No. The shell applies redirection for stdout to /tmp/mesgFile. Cat is then invoked, and it reads from stdin since no files are present on the command line, and writes to its stdout. Remember that the shell has already redirected stdout to a file, so cat effectively writes to the file. But cat doesn't know this - all it knows is that it's writing to its stdout. The bit in brackets is grouped as a single item. But before it's executed the shell opens fd 3 and attaches its input/output to the network socket tcp/25. Now as you work through the lines inside the brackets you have this additional descriptor available to you. > Does: 3<>/dev/tcp/$smtp_server/25 > mean: let fd3 have input AND output to that-device? > > *THAT* is the 'fraud'(:-;) !! > Only AFTER it's been used is it defined. No. The shell applies redirection before the command (or subshell) is executed. This is all documented in the man page. > It would be good if the *nix docos put UP FRONT that > 'it's not parsed sequentially left-to-right'; like computers > work or mathematical theorems are proved. It's in the shell man page under the heading REDIRECTION. This is referenced several times from the section SHELL GRAMMAR that explains the basic shell syntax. 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