changeset 4:c707b0c5c849

new text about pipes
author meillo@marmaro.de
date Fri, 12 Feb 2010 19:30:13 +0100
parents aebbe3e76f5e
children 48f1f3465550
files unix-phil.ms
diffstat 1 files changed, 73 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/unix-phil.ms	Wed Feb 10 13:19:04 2010 +0100
+++ b/unix-phil.ms	Fri Feb 12 19:30:13 2010 +0100
@@ -166,15 +166,82 @@
 
 .NH 1
 The Unix Philosophy
-
+.LP
+The origins of the Unix Philosophy were already introduced.
+This chapter explains the philosophy and shows concrete examples of its application.
 .NH 2
-what it is
+Examples
 .LP
-definitions by McIlroy, Gancarz, ESR (maybe already in the intro)
+Following are some examples to demonstrate how applied Unix Philosophy feels like.
+Knowledge of using the Unix shell is assumed.
+.PP
+Counting the number of files in the current directory:
+.DS
+.CW
+ls | wc -l
+.DE
+The
+.CW ls
+command lists all files in the current directory, one per line,
+and
+.CW "wc -l
+counts how many lines they are.
+.PP
+Counting all files that do not contain ``foo'' in their name:
+.DS
+.CW
+ls | grep -v foo | wc -l
+.DE
+Here, the list of files is filtered by
+.CW grep
+to remove all that contain ``foo''.
+The rest is the same as in the previous example.
+.PP
+Finding the five largest entries in the current directory.
+.DS
+.CW
+du -s * | sort -nr | sed 5q
+.DE
+.CW "du -s *
+returns the recursively summed sizes of all files
+-- no matter if they are regular files or directories.
+.CW "sort -nr
+sorts the list numerically in reverse order.
+Finally,
+.CW "sed 5q
+quits after it has printed the fifth line.
+.PP
+The presented command lines are examples of what Unix people would use
+to get the desired output.
+There are also other ways to get the same output.
+It's a user's decision which way to go.
+.NH 2
+Pipes
 .LP
-cf. unix tool chain
-.LP
-enabler pipe
+The examples show that a lot of tasks on a Unix system
+are accomplished by combining several small programs.
+The connection between the single programs is denoted by the pipe operator `|'.
+.PP
+Pipes, and their extensive and easy use, are one of the great
+achievements of the Unix system.
+Pipes between programs have been possible in earlier operating systems,
+but it has never been a so central part of the concept.
+When, in the early seventies, Doug McIlroy introduced pipes for the
+Unix system,
+``it was this concept and notation for linking several programs together
+that transformed Unix from a basic file-sharing system to an entirely new way of computing.''
+.[
+%T Unix: An Oral History
+%O http://www.princeton.edu/~hos/frs122/unixhist/finalhis.htm
+.] 
+.PP
+Being able to specify pipelines in an easy way is,
+however, not enough by itself.
+It is only one part.
+The other is the design of the programs that are used in the pipeline.
+They have to be of an external shape that allows them to be be used in a pipeline.
+
+
 
 .NH 2
 Architecture