annotate unix-phil.ms @ 4:c707b0c5c849

new text about pipes
author meillo@marmaro.de
date Fri, 12 Feb 2010 19:30:13 +0100
parents aebbe3e76f5e
children 48f1f3465550
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
1 .\".if n .pl 1000i
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
2 .de XX
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
3 .pl 1v
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
4 ..
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
5 .em XX
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
6 .\".nr PI 0
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
7 .\".if t .nr PD .5v
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
8 .\".if n .nr PD 1v
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
9 .nr lu 0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
10 .de CW
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
11 .nr PQ \\n(.f
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
12 .if t .ft CW
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
13 .ie \\$1 .if n .ul 999
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
14 .el .if n .ul 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
15 .if t .if !\\$1 \&\\$1\f\\n(PQ\\$2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
16 .if n .if \\n(.$=1 \&\\$1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
17 .if n .if \\n(.$>1 \&\\$1\c
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
18 .if n .if \\n(.$>1 \&\\$2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
19 ..
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
20 .ds [. \ [
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
21 .ds .] ]
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
22 .\"----------------------------------------
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
23 .TL
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
24 Why the Unix Philosophy matters
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
25 .AU
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
26 markus schnalke <meillo@marmaro.de>
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
27 .AB
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
28 .ti \n(.iu
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
29 This paper discusses the importance of the Unix Philosophy in software design.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
30 Today, few software designers are aware of these concepts,
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
31 and thus most modern software is limited and does not make use of software leverage.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
32 Knowing and following the tenets of the Unix Philosophy makes software more valuable.
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
33 .AE
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
34
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
35 .if t .2C
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
36
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
37 .FS
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
38 .ps -1
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
39 This paper was prepared for the seminar ``Software Analysis'' at University Ulm.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
40 Mentor was professor Schweiggert. 2010-02-05
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
41 .br
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
42 You may get this document from my website
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
43 .CW \s-1http://marmaro.de/docs
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
44 .FE
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
45
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
46 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
47 Introduction
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
48 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
49 Building a software is a process from an idea of the purpose of the software
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
50 to its release.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
51 No matter \fIhow\fP the process is run, two things are common:
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
52 the initial idea and the release.
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
53 The process inbetween can be of any shape.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
54 The the maintainance work after the release is ignored for the moment.
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
55 .PP
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
56 The process of building splits mainly in two parts:
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
57 the planning of what and how to build, and implementing the plan by writing code.
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
58 This paper focuses on the planning part \(en the designing of the software.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
59 .PP
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
60 Software design is the plan of how the internals and externals of the software should look like,
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
61 based on the requirements.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
62 This paper discusses the recommendations of the Unix Philosphy about software design.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
63 .PP
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
64 The here discussed ideas can get applied by any development process.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
65 The Unix Philosphy does recommend how the software development process should look like,
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
66 but this shall not be of matter here.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
67 Similar, the question of how to write the code is out of focus.
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
68 .PP
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
69 The name ``Unix Philosophy'' was already mentioned several times, but it was not explained yet.
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
70 The Unix Philosophy is the essence of how the Unix operating system and its toolchest was designed.
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
71 It is no limited set of rules, but what people see to be common to typical Unix software.
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
72 Several people stated their view on the Unix Philosophy.
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
73 Best known are:
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
74 .IP \(bu
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
75 Doug McIlroy's summary: ``Write programs that do one thing and do it well.''
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
76 .[
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
77 %A M. D. McIlroy
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
78 %A E. N. Pinson
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
79 %A B. A. Taque
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
80 %T UNIX Time-Sharing System Forward
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
81 %J The Bell System Technical Journal
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
82 %D 1978
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
83 %V 57
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
84 %N 6
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
85 %P 1902
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
86 .]
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
87 .IP \(bu
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
88 Mike Gancarz' book ``The UNIX Philosophy''.
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
89 .[
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
90 %A Mike Gancarz
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
91 %T The UNIX Philosophy
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
92 %D 1995
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
93 %I Digital Press
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
94 .]
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
95 .IP \(bu
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
96 Eric S. Raymond's book ``The Art of UNIX Programming''.
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
97 .[
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
98 %A Eric S. Raymond
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
99 %T The Art of UNIX Programming
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
100 %D 2003
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
101 %I Addison-Wesley
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
102 %O .CW \s-1http://www.faqs.org/docs/artu/
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
103 .]
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
104 .LP
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
105 These different views on the Unix Philosophy have much in common.
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
106 Especially, the main concepts are similar for all of them.
1
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
107 But there are also points on which they differ.
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
108 This only underlines what the Unix Philosophy is:
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
109 A retrospective view on the main concepts of Unix software;
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
110 especially those that were sucessful and unique to Unix.
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
111 .PP
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
112 Before we will have a look at concrete concepts,
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
113 we discuss why software design is important
9b555c009f19 further text in intro
meillo@marmaro.de
parents: 0
diff changeset
114 and what problems bad design introduces.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
115
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
116
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
117 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
118 Importance of software design
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
119 .LP
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
120 Why should we design software at all?
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
121 It is general knowledge, that a bad plan is better than no plan.
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
122 As stated earlier in this document, the process of building a software
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
123 means going from an idea to a release.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
124 The development process tells how to get from the idea to the release.
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
125 Software design is the shape of the built software.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
126 This means, that different designs of a software would be different target points to go to.
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
127 Thus, the design of a software defines the global direction the development goes.
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
128 .PP
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
129 It is not enough that the released software offers all requested functionality.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
130 It is a misbelief that only function matters.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
131 Building a software the first time is only a small part of the overall work.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
132 The larger part begins when the software is released for the first time
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
133 \(en maintainance and extending work..
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
134 This part soon covers more time than the time which was needed to build the software the first time.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
135 .\" cf. brooks?
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
136 .PP
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
137 The extendability and maitainability of a software highly depends on its design.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
138 Good design eases these tasks much.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
139 Bad design, in contrast, requires much more effort for maintaining and
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
140 extending the software.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
141 Developers should, for their own best, have maintainability and extendability in mind
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
142 when they design the software.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
143 .PP
3
aebbe3e76f5e minor rework
meillo@marmaro.de
parents: 2
diff changeset
144 Users of the software, in contrast, do not care about maintainability and extendability,
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
145 at least not directly.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
146 They care about usability and flexibility.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
147 They want the software to directly solve their problems.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
148 They want to be able to to use all its functions if they learned a few of them.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
149 They want to use the software for similar tasks.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
150 Software is successful if users enjoy using it.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
151 Good software design can offer great flexibility and usability.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
152 .PP
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
153 Good design matters for developers \fIand\fP for users.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
154 Hence both groups should care about good software design.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
155 Bad design limits the software in some way.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
156 It may still provide all requested function, but it will have worse quality,
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
157 and thus require more work effort for developers or frustrate users.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
158 .PP
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
159 Good software design is to the implementation like data structures are to algorithms
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
160 \(en if you get the former right, then you do not need to care about the latter,
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
161 it will simply go the right way.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
162 .\" cf. ??? ``good data, bad algos''
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
163
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
164
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
165
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
166
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
167 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
168 The Unix Philosophy
4
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
169 .LP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
170 The origins of the Unix Philosophy were already introduced.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
171 This chapter explains the philosophy and shows concrete examples of its application.
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
172 .NH 2
4
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
173 Examples
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
174 .LP
4
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
175 Following are some examples to demonstrate how applied Unix Philosophy feels like.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
176 Knowledge of using the Unix shell is assumed.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
177 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
178 Counting the number of files in the current directory:
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
179 .DS
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
180 .CW
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
181 ls | wc -l
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
182 .DE
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
183 The
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
184 .CW ls
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
185 command lists all files in the current directory, one per line,
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
186 and
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
187 .CW "wc -l
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
188 counts how many lines they are.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
189 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
190 Counting all files that do not contain ``foo'' in their name:
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
191 .DS
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
192 .CW
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
193 ls | grep -v foo | wc -l
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
194 .DE
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
195 Here, the list of files is filtered by
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
196 .CW grep
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
197 to remove all that contain ``foo''.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
198 The rest is the same as in the previous example.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
199 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
200 Finding the five largest entries in the current directory.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
201 .DS
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
202 .CW
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
203 du -s * | sort -nr | sed 5q
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
204 .DE
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
205 .CW "du -s *
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
206 returns the recursively summed sizes of all files
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
207 -- no matter if they are regular files or directories.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
208 .CW "sort -nr
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
209 sorts the list numerically in reverse order.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
210 Finally,
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
211 .CW "sed 5q
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
212 quits after it has printed the fifth line.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
213 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
214 The presented command lines are examples of what Unix people would use
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
215 to get the desired output.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
216 There are also other ways to get the same output.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
217 It's a user's decision which way to go.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
218 .NH 2
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
219 Pipes
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
220 .LP
4
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
221 The examples show that a lot of tasks on a Unix system
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
222 are accomplished by combining several small programs.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
223 The connection between the single programs is denoted by the pipe operator `|'.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
224 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
225 Pipes, and their extensive and easy use, are one of the great
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
226 achievements of the Unix system.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
227 Pipes between programs have been possible in earlier operating systems,
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
228 but it has never been a so central part of the concept.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
229 When, in the early seventies, Doug McIlroy introduced pipes for the
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
230 Unix system,
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
231 ``it was this concept and notation for linking several programs together
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
232 that transformed Unix from a basic file-sharing system to an entirely new way of computing.''
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
233 .[
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
234 %T Unix: An Oral History
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
235 %O http://www.princeton.edu/~hos/frs122/unixhist/finalhis.htm
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
236 .]
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
237 .PP
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
238 Being able to specify pipelines in an easy way is,
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
239 however, not enough by itself.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
240 It is only one part.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
241 The other is the design of the programs that are used in the pipeline.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
242 They have to be of an external shape that allows them to be be used in a pipeline.
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
243
c707b0c5c849 new text about pipes
meillo@marmaro.de
parents: 3
diff changeset
244
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
245
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
246 .NH 2
2
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
247 Architecture
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
248 .LP
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
249 the most important design decision.
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
250
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
251 the topic here
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
252
fbd7baf6a61f added content about sw design; some formating
meillo@marmaro.de
parents: 1
diff changeset
253 .NH 2
0
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
254 Interface architecture
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
255 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
256 standalone vs. tool chain
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
257 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
258 software leverage
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
259 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
260 possiblities
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
261
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
262 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
263 Results
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
264 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
265 The unix phil is an answer to the sw design question
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
266 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
267 tool chains empower the uses of sw
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
268
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
269 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
270 Case study: nmh
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
271
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
272 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
273 History
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
274 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
275 MH, nmh.
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
276 They are old.
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
277
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
278 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
279 Contrasts to similar sw
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
280 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
281 vs. Thunderbird, mutt, mailx, pine
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
282 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
283 flexibility, no redundancy, use the shell
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
284
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
285 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
286 Gains of the design
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
287 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
288
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
289 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
290 Problems
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
291 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
292
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
293 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
294 Case study: uzbl
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
295
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
296 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
297 History
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
298 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
299 uzbl is young
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
300
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
301 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
302 Contrasts to similar sw
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
303 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
304 like with nmh
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
305 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
306 addons, plugins, modules
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
307
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
308 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
309 Gains of the design
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
310 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
311
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
312 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
313 Problems
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
314 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
315 broken web
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
316
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
317 .NH 1
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
318 Final thoughts
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
319
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
320 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
321 Quick summary
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
322 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
323 good design
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
324 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
325 unix phil
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
326 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
327 case studies
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
328
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
329 .NH 2
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
330 Why people should choose
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
331 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
332 Make the right choice!
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
333
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
334 .nr PI .5i
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
335 .rm ]<
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
336 .de ]<
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
337 .LP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
338 .de FP
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
339 .IP \\\\$1.
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
340 \\..
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
341 .rm FS FE
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
342 ..
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
343 .SH
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
344 References
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
345 .[
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
346 $LIST$
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
347 .]
cecef8bfa812 early version, mainly the outline
meillo@marmaro.de
parents:
diff changeset
348 .wh -1p