author | amit@thunder |
Thu, 25 Feb 2010 00:04:27 +0530 | |
changeset 27 | cb14131583c6 |
parent 25 | ed38dd9bdb50 |
child 28 | 514098969b11 |
permissions | -rw-r--r-- |
1
672eaaab9204
Added some new html files that failed earlier during change from rst
amit@thunder
parents:
diff
changeset
|
1 |
<html> |
6 | 2 |
<head> |
3 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
|
4 |
<title> |
|
5 |
Chapter. Section_ |
|
6 |
</title> |
|
15 | 7 |
<link rel="stylesheet" href="/review/support/styles.css" type="text/css" /> |
8 |
<meta name="generator" content="DocBook XSL Stylesheets V1.74.3" /> |
|
9 |
<link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png" /> |
|
10 |
<script type="text/javascript" src="/review/support/jquery-min.js"> |
|
11 |
</script> |
|
12 |
<script type="text/javascript" src="/review/support/form.js"> |
|
13 |
</script> |
|
14 |
<script type="text/javascript" src="/review/support/hsbook.js"> |
|
15 |
</script> |
|
6 | 16 |
</head> |
17 |
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
18 |
<div class="chapter" id="chn11Section_5"> |
6 | 19 |
<div class="titlepage"> |
20 |
</div> |
|
21 |
<div class="toc"> |
|
22 |
<p> |
|
23 |
<b> |
|
24 |
Table of Contents |
|
25 |
</b> |
|
26 |
</p> |
|
27 |
<dl> |
|
28 |
<dt> |
|
29 |
<span class="article"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
30 |
<a href="#id2886967"> |
6 | 31 |
</a> |
32 |
</span> |
|
33 |
</dt> |
|
34 |
<dd> |
|
35 |
<dl> |
|
36 |
<dt> |
|
37 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
38 |
<a href="#id2697058"> |
25 | 39 |
1. Module Objectives: |
6 | 40 |
</a> |
41 |
</span> |
|
42 |
</dt> |
|
43 |
<dt> |
|
44 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
45 |
<a href="#id2885319"> |
25 | 46 |
2. tar: |
6 | 47 |
</a> |
48 |
</span> |
|
49 |
</dt> |
|
50 |
<dd> |
|
51 |
<dl> |
|
52 |
<dt> |
|
53 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
54 |
<a href="#id2885872"> |
25 | 55 |
2.1. Introduction: |
6 | 56 |
</a> |
57 |
</span> |
|
58 |
</dt> |
|
59 |
<dt> |
|
60 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
61 |
<a href="#id2937939"> |
25 | 62 |
2.2. Getting Started(go go go!): |
6 | 63 |
</a> |
64 |
</span> |
|
65 |
</dt> |
|
66 |
<dt> |
|
67 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
68 |
<a href="#id2938218"> |
25 | 69 |
2.3. Further Reading for this section: |
6 | 70 |
</a> |
71 |
</span> |
|
72 |
</dt> |
|
73 |
</dl> |
|
74 |
</dd> |
|
75 |
<dt> |
|
76 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
77 |
<a href="#id2938263"> |
25 | 78 |
3. GZip: |
6 | 79 |
</a> |
80 |
</span> |
|
81 |
</dt> |
|
82 |
<dd> |
|
83 |
<dl> |
|
84 |
<dt> |
|
85 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
86 |
<a href="#id2938288"> |
25 | 87 |
3.1. Get going: |
6 | 88 |
</a> |
89 |
</span> |
|
90 |
</dt> |
|
91 |
<dt> |
|
92 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
93 |
<a href="#id2938542"> |
25 | 94 |
3.2. Further Reading for this section: |
6 | 95 |
</a> |
96 |
</span> |
|
97 |
</dt> |
|
98 |
</dl> |
|
99 |
</dd> |
|
100 |
<dt> |
|
101 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
102 |
<a href="#id2938596"> |
25 | 103 |
4. File Comparisons: |
6 | 104 |
</a> |
105 |
</span> |
|
106 |
</dt> |
|
107 |
<dd> |
|
108 |
<dl> |
|
109 |
<dt> |
|
110 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
111 |
<a href="#id2938613"> |
25 | 112 |
4.1. cmp: |
6 | 113 |
</a> |
114 |
</span> |
|
115 |
</dt> |
|
116 |
<dt> |
|
117 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
118 |
<a href="#id2938655"> |
25 | 119 |
4.2. diff: |
6 | 120 |
</a> |
121 |
</span> |
|
122 |
</dt> |
|
123 |
<dt> |
|
124 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
125 |
<a href="#id2938737"> |
25 | 126 |
4.3. comm: |
6 | 127 |
</a> |
128 |
</span> |
|
129 |
</dt> |
|
130 |
</dl> |
|
131 |
</dd> |
|
132 |
<dt> |
|
133 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
134 |
<a href="#id2938767"> |
25 | 135 |
5. Environment Variables: |
6 | 136 |
</a> |
137 |
</span> |
|
138 |
</dt> |
|
139 |
<dd> |
|
140 |
<dl> |
|
141 |
<dt> |
|
142 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
143 |
<a href="#id2938866"> |
25 | 144 |
5.1. Further Reading: |
6 | 145 |
</a> |
146 |
</span> |
|
147 |
</dt> |
|
148 |
</dl> |
|
149 |
</dd> |
|
150 |
<dt> |
|
151 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
152 |
<a href="#id2938921"> |
25 | 153 |
6. Shell Scripting: |
6 | 154 |
</a> |
155 |
</span> |
|
156 |
</dt> |
|
157 |
<dd> |
|
158 |
<dl> |
|
159 |
<dt> |
|
160 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
161 |
<a href="#id2938929"> |
25 | 162 |
6.1. Basics: |
6 | 163 |
</a> |
164 |
</span> |
|
165 |
</dt> |
|
166 |
<dt> |
|
167 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
168 |
<a href="#id2937287"> |
25 | 169 |
6.2. Shell Arithmetic: |
6 | 170 |
</a> |
171 |
</span> |
|
172 |
</dt> |
|
173 |
<dt> |
|
174 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
175 |
<a href="#id2939306"> |
25 | 176 |
6.3. if else construct: |
6 | 177 |
</a> |
178 |
</span> |
|
179 |
</dt> |
|
180 |
<dt> |
|
181 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
182 |
<a href="#id2939412"> |
25 | 183 |
6.4. Loops |
6 | 184 |
</a> |
185 |
</span> |
|
186 |
</dt> |
|
187 |
<dt> |
|
188 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
189 |
<a href="#id2939658"> |
25 | 190 |
6.5. Functions |
191 |
</a> |
|
192 |
</span> |
|
193 |
</dt> |
|
194 |
<dt> |
|
195 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
196 |
<a href="#id2939729"> |
25 | 197 |
6.6. Further Reading: |
6 | 198 |
</a> |
199 |
</span> |
|
200 |
</dt> |
|
201 |
</dl> |
|
202 |
</dd> |
|
203 |
</dl> |
|
204 |
</dd> |
|
205 |
</dl> |
|
206 |
</div> |
|
207 |
<div class="article"> |
|
208 |
<div class="titlepage"> |
|
209 |
<div> |
|
210 |
<div> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
211 |
<h2 class="title" id="id2886967"> |
25 | 212 |
</h2> |
213 |
</div> |
|
214 |
<div> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
215 |
<h2 class="title" id="id2886967"> |
6 | 216 |
</h2> |
217 |
</div> |
|
218 |
</div> |
|
219 |
<hr /> |
|
220 |
</div> |
|
221 |
<div class="toc"> |
|
222 |
<p> |
|
223 |
<b> |
|
224 |
Table of Contents |
|
225 |
</b> |
|
226 |
</p> |
|
227 |
<dl> |
|
228 |
<dt> |
|
229 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
230 |
<a href="#id2697058"> |
25 | 231 |
1. Module Objectives: |
6 | 232 |
</a> |
233 |
</span> |
|
234 |
</dt> |
|
235 |
<dt> |
|
236 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
237 |
<a href="#id2885319"> |
25 | 238 |
2. tar: |
6 | 239 |
</a> |
240 |
</span> |
|
241 |
</dt> |
|
242 |
<dd> |
|
243 |
<dl> |
|
244 |
<dt> |
|
245 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
246 |
<a href="#id2885872"> |
25 | 247 |
2.1. Introduction: |
6 | 248 |
</a> |
249 |
</span> |
|
250 |
</dt> |
|
251 |
<dt> |
|
252 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
253 |
<a href="#id2937939"> |
25 | 254 |
2.2. Getting Started(go go go!): |
6 | 255 |
</a> |
256 |
</span> |
|
257 |
</dt> |
|
258 |
<dt> |
|
259 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
260 |
<a href="#id2938218"> |
25 | 261 |
2.3. Further Reading for this section: |
6 | 262 |
</a> |
263 |
</span> |
|
264 |
</dt> |
|
265 |
</dl> |
|
266 |
</dd> |
|
267 |
<dt> |
|
268 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
269 |
<a href="#id2938263"> |
25 | 270 |
3. GZip: |
6 | 271 |
</a> |
272 |
</span> |
|
273 |
</dt> |
|
274 |
<dd> |
|
275 |
<dl> |
|
276 |
<dt> |
|
277 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
278 |
<a href="#id2938288"> |
25 | 279 |
3.1. Get going: |
6 | 280 |
</a> |
281 |
</span> |
|
282 |
</dt> |
|
283 |
<dt> |
|
284 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
285 |
<a href="#id2938542"> |
25 | 286 |
3.2. Further Reading for this section: |
6 | 287 |
</a> |
288 |
</span> |
|
289 |
</dt> |
|
290 |
</dl> |
|
291 |
</dd> |
|
292 |
<dt> |
|
293 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
294 |
<a href="#id2938596"> |
25 | 295 |
4. File Comparisons: |
6 | 296 |
</a> |
297 |
</span> |
|
298 |
</dt> |
|
299 |
<dd> |
|
300 |
<dl> |
|
301 |
<dt> |
|
302 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
303 |
<a href="#id2938613"> |
25 | 304 |
4.1. cmp: |
6 | 305 |
</a> |
306 |
</span> |
|
307 |
</dt> |
|
308 |
<dt> |
|
309 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
310 |
<a href="#id2938655"> |
25 | 311 |
4.2. diff: |
6 | 312 |
</a> |
313 |
</span> |
|
314 |
</dt> |
|
315 |
<dt> |
|
316 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
317 |
<a href="#id2938737"> |
25 | 318 |
4.3. comm: |
6 | 319 |
</a> |
320 |
</span> |
|
321 |
</dt> |
|
322 |
</dl> |
|
323 |
</dd> |
|
324 |
<dt> |
|
325 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
326 |
<a href="#id2938767"> |
25 | 327 |
5. Environment Variables: |
6 | 328 |
</a> |
329 |
</span> |
|
330 |
</dt> |
|
331 |
<dd> |
|
332 |
<dl> |
|
333 |
<dt> |
|
334 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
335 |
<a href="#id2938866"> |
25 | 336 |
5.1. Further Reading: |
6 | 337 |
</a> |
338 |
</span> |
|
339 |
</dt> |
|
340 |
</dl> |
|
341 |
</dd> |
|
342 |
<dt> |
|
343 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
344 |
<a href="#id2938921"> |
25 | 345 |
6. Shell Scripting: |
6 | 346 |
</a> |
347 |
</span> |
|
348 |
</dt> |
|
349 |
<dd> |
|
350 |
<dl> |
|
351 |
<dt> |
|
352 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
353 |
<a href="#id2938929"> |
25 | 354 |
6.1. Basics: |
355 |
</a> |
|
356 |
</span> |
|
357 |
</dt> |
|
358 |
<dt> |
|
359 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
360 |
<a href="#id2937287"> |
25 | 361 |
6.2. Shell Arithmetic: |
362 |
</a> |
|
363 |
</span> |
|
364 |
</dt> |
|
365 |
<dt> |
|
366 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
367 |
<a href="#id2939306"> |
25 | 368 |
6.3. if else construct: |
369 |
</a> |
|
370 |
</span> |
|
371 |
</dt> |
|
372 |
<dt> |
|
373 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
374 |
<a href="#id2939412"> |
25 | 375 |
6.4. Loops |
376 |
</a> |
|
377 |
</span> |
|
378 |
</dt> |
|
379 |
<dt> |
|
380 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
381 |
<a href="#id2939658"> |
25 | 382 |
6.5. Functions |
383 |
</a> |
|
384 |
</span> |
|
385 |
</dt> |
|
386 |
<dt> |
|
387 |
<span class="section"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
388 |
<a href="#id2939729"> |
25 | 389 |
6.6. Further Reading: |
6 | 390 |
</a> |
391 |
</span> |
|
392 |
</dt> |
|
393 |
</dl> |
|
394 |
</dd> |
|
395 |
</dl> |
|
396 |
</div> |
|
25 | 397 |
<div class="section" title="1.Module Objectives:"> |
6 | 398 |
<div class="titlepage"> |
399 |
<div> |
|
400 |
<div> |
|
401 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
402 |
<a name="id2697058"> |
6 | 403 |
</a> |
25 | 404 |
1.Module Objectives: |
6 | 405 |
</h2> |
406 |
</div> |
|
407 |
</div> |
|
408 |
</div> |
|
409 |
<p id="ch11Section_5_1"> |
|
25 | 410 |
After successfully completing this module a participant will be able to: |
6 | 411 |
</p> |
25 | 412 |
<pre class="programlisting"> |
413 |
- Understand |
|
414 |
* What are archives and zipped files U |
|
415 |
* What are environment variables U |
|
416 |
* What are Shell Scripts U |
|
417 |
- Able to use file comparison commands like Ap |
|
418 |
diff, cmp, comm |
|
419 |
- Create and extract archives(.tar files) and zipped files(.gz) Ap |
|
420 |
- Set/Modify environment as per need Ap |
|
421 |
- Create shell scripts to automate tasks. Ap |
|
422 |
</pre> |
|
423 |
</div> |
|
424 |
<div class="section" title="2.tar:"> |
|
425 |
<div class="titlepage"> |
|
426 |
<div> |
|
427 |
<div> |
|
428 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
429 |
<a name="id2885319"> |
25 | 430 |
</a> |
431 |
2.tar: |
|
432 |
</h2> |
|
433 |
</div> |
|
434 |
</div> |
|
435 |
</div> |
|
436 |
<div class="section" title="2.1.Introduction:"> |
|
6 | 437 |
<div class="titlepage"> |
438 |
<div> |
|
439 |
<div> |
|
440 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
441 |
<a name="id2885872"> |
6 | 442 |
</a> |
25 | 443 |
2.1.Introduction: |
6 | 444 |
</h3> |
445 |
</div> |
|
446 |
</div> |
|
447 |
</div> |
|
25 | 448 |
<p id="ch11Section_5_2"> |
449 |
In world of Linux based distribution, |
|
450 |
<span class="emphasis"> |
|
451 |
<em> |
|
452 |
tarballs |
|
453 |
</em> |
|
454 |
</span> |
|
455 |
is the term which pops up very often. It is part of the GNU project and comes as part of every distribution of GNU/Linux. Tarball is like defacto standard for releasing source code for free software. Some of common use of |
|
456 |
<span class="emphasis"> |
|
457 |
<em> |
|
458 |
tar |
|
459 |
</em> |
|
460 |
</span> |
|
461 |
archives is to: |
|
462 |
<span class="emphasis"> |
|
463 |
<em> |
|
464 |
Store, backup, and transport |
|
465 |
</em> |
|
466 |
</span> |
|
467 |
. |
|
468 |
</p> |
|
469 |
<p id="ch11Section_5_3"> |
|
470 |
GNU tar creates and manipulates archives which are actually collections of many other files; the program provides users with an organized and systematic method for controlling a large amount of data. It is basically form of creating archive by concatenating one or more files. |
|
471 |
</p> |
|
6 | 472 |
</div> |
25 | 473 |
<div class="section" title="2.2.Getting Started(go go go!):"> |
6 | 474 |
<div class="titlepage"> |
475 |
<div> |
|
476 |
<div> |
|
477 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
478 |
<a name="id2937939"> |
6 | 479 |
</a> |
25 | 480 |
2.2.Getting Started(go go go!): |
6 | 481 |
</h3> |
482 |
</div> |
|
483 |
</div> |
|
484 |
</div> |
|
25 | 485 |
<p id="ch11Section_5_4"> |
486 |
As mentioned previously and if not, |
|
487 |
<span class="emphasis"> |
|
488 |
<em> |
|
489 |
The best way to get started with any command line tool of Linux is to use "man". |
|
490 |
</em> |
|
491 |
</span> |
|
492 |
</p> |
|
493 |
<pre class="programlisting"> |
|
494 |
$ man tar |
|
495 |
</pre> |
|
496 |
<p id="ch11Section_5_5"> |
|
497 |
or try these commands(the output may vary with different installations): |
|
6 | 498 |
</p> |
25 | 499 |
<pre class="programlisting"> |
500 |
$ tar --version |
|
501 |
tar (GNU tar) 1.20 |
|
502 |
Copyright (C) 2008 Free Software Foundation, Inc. |
|
503 |
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> |
|
504 |
This is free software: you are free to change and redistribute it. |
|
505 |
There is NO WARRANTY, to the extent permitted by law. |
|
506 |
||
507 |
Written by John Gilmore and Jay Fenlason. |
|
508 |
||
509 |
$ tar --help |
|
510 |
Usage: tar [OPTION...] [FILE]... |
|
511 |
GNU `tar' saves many files together into a single tape or disk archive, and can |
|
512 |
restore individual files from the archive. |
|
513 |
Examples: |
|
514 |
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar. |
|
515 |
tar -tvf archive.tar # List all files in archive.tar verbosely. |
|
516 |
tar -xf archive.tar # Extract all files from archive.tar. |
|
517 |
____________ |
|
518 |
</pre> |
|
519 |
<div class="section" title="2.2.1.Creating a tar archive:"> |
|
6 | 520 |
<div class="titlepage"> |
521 |
<div> |
|
522 |
<div> |
|
523 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
524 |
<a name="id2937993"> |
6 | 525 |
</a> |
25 | 526 |
2.2.1.Creating a tar archive: |
6 | 527 |
</h4> |
528 |
</div> |
|
529 |
</div> |
|
530 |
</div> |
|
25 | 531 |
<p id="ch11Section_5_6"> |
532 |
We will do some off-the road activity for this exercise. We will use an interesting command |
|
533 |
<span class="emphasis"> |
|
534 |
<em> |
|
535 |
fortune |
|
536 |
</em> |
|
537 |
</span> |
|
538 |
for creating our practice files and then performing archives of those files and directories. Content of the files would vary for users, as fortune works like that. |
|
539 |
</p> |
|
540 |
<pre class="programlisting"> |
|
541 |
$ mkdir fortune-files |
|
542 |
$ cd fortune-files/ |
|
543 |
$ fortune > first.txt |
|
544 |
$ cat first.txt |
|
545 |
Expect the worst, it's the least you can do. |
|
546 |
$ fortune > second.txt |
|
547 |
$ fortune > third.txt |
|
548 |
$ ls |
|
549 |
first.txt second.txt third.txt |
|
550 |
</pre> |
|
551 |
<p id="ch11Section_5_7"> |
|
552 |
By now we have three txt files, with some random fortune content. To create a tar archive of these files we can use any of following commands according to ones convenience: |
|
6 | 553 |
</p> |
25 | 554 |
<pre class="programlisting"> |
555 |
$ tar --create --verbose --file=allfiles.tar first.txt second.txt third.txt |
|
556 |
first.txt |
|
557 |
second.txt |
|
558 |
third.txt |
|
559 |
$ ls |
|
560 |
allfiles.tar first.txt second.txt third.txt |
|
561 |
</pre> |
|
562 |
<p id="ch11Section_5_8"> |
|
563 |
allfiles.tar is our required tar archive of all the rest of files(or archive of files mentioned in command line). Other form of the previous command are: |
|
564 |
</p> |
|
565 |
<pre class="programlisting"> |
|
566 |
$ tar -c -v -f allfiles.tar first.txt second.txt third.txt |
|
567 |
</pre> |
|
568 |
<p id="ch11Section_5_9"> |
|
569 |
or |
|
570 |
</p> |
|
571 |
<pre class="programlisting"> |
|
572 |
$ tar -cvf allfiles.tar first.txt second.txt third.txt |
|
573 |
</pre> |
|
574 |
<p id="ch11Section_5_a"> |
|
575 |
The general format for creating a tar archive is: |
|
576 |
</p> |
|
577 |
<pre class="programlisting"> |
|
578 |
tar [OPTION...] [FILE]... |
|
579 |
</pre> |
|
580 |
<p id="ch11Section_5_b"> |
|
581 |
For our command are using these options: |
|
6 | 582 |
</p> |
25 | 583 |
<div class="itemizedlist"> |
584 |
<ul class="itemizedlist" type="*"> |
|
585 |
<li class="listitem" style="list-style-type: *"> |
|
586 |
<p id="ch11Section_5_c"> |
|
587 |
-c to Create the archive. |
|
588 |
</p> |
|
589 |
</li> |
|
590 |
<li class="listitem" style="list-style-type: *"> |
|
591 |
<p id="ch11Section_5_d"> |
|
592 |
-v for Verbose mode, to get the names of the files as they are archived. |
|
593 |
</p> |
|
594 |
</li> |
|
595 |
<li class="listitem" style="list-style-type: *"> |
|
596 |
<p id="ch11Section_5_e"> |
|
597 |
-f mentioning the file name of the resulting tar archive. |
|
598 |
</p> |
|
599 |
</li> |
|
600 |
</ul> |
|
601 |
</div> |
|
602 |
<p id="ch11Section_5_f"> |
|
603 |
To create archive of folder itself try this: |
|
6 | 604 |
</p> |
25 | 605 |
<pre class="programlisting"> |
606 |
$ tar -cvf fortune.tar fortune/ |
|
607 |
</pre> |
|
608 |
<p id="ch11Section_5_10"> |
|
609 |
To add files to existing tar archive, option |
|
610 |
<span class="emphasis"> |
|
611 |
<em> |
|
612 |
`r` |
|
613 |
</em> |
|
614 |
</span> |
|
615 |
is used: |
|
616 |
</p> |
|
617 |
<pre class="programlisting"> |
|
618 |
$ fortune > fourth.txt |
|
619 |
$ tar -r fourth.txt -vf allfiles.tar |
|
620 |
fourth.txt |
|
621 |
</pre> |
|
622 |
<p id="ch11Section_5_11"> |
|
623 |
There are other options too available for explicitly mentioning the position of archive, use |
|
624 |
<span class="emphasis"> |
|
625 |
<em> |
|
626 |
tar --help |
|
627 |
</em> |
|
628 |
</span> |
|
629 |
for getting all the details. |
|
630 |
</p> |
|
631 |
<p id="ch11Section_5_12"> |
|
632 |
Similarly to remove file from archive use |
|
633 |
<span class="emphasis"> |
|
634 |
<em> |
|
635 |
--delete |
|
636 |
</em> |
|
637 |
</span> |
|
638 |
option: |
|
639 |
</p> |
|
640 |
<pre class="programlisting"> |
|
641 |
$ tar --delete second.txt -f allfiles.tar |
|
642 |
$ tar -tf allfiles.tar |
|
643 |
first.txt |
|
644 |
third.txt |
|
645 |
fourth.txt |
|
646 |
</pre> |
|
6 | 647 |
</div> |
25 | 648 |
<div class="section" title="2.2.2.Listing the files of archive:"> |
6 | 649 |
<div class="titlepage"> |
650 |
<div> |
|
651 |
<div> |
|
652 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
653 |
<a name="id2938133"> |
6 | 654 |
</a> |
25 | 655 |
2.2.2.Listing the files of archive: |
6 | 656 |
</h4> |
657 |
</div> |
|
658 |
</div> |
|
659 |
</div> |
|
660 |
<p id="ch11Section_5_13"> |
|
25 | 661 |
Once files are archived, tar command have the |
662 |
<span class="emphasis"> |
|
663 |
<em> |
|
664 |
`t` |
|
665 |
</em> |
|
666 |
</span> |
|
667 |
option, for Listing all files in the tar file: |
|
6 | 668 |
</p> |
25 | 669 |
<pre class="programlisting"> |
670 |
$ tar tf allfiles.tar |
|
671 |
first.txt |
|
672 |
second.txt |
|
673 |
third.txt |
|
674 |
</pre> |
|
6 | 675 |
<p id="ch11Section_5_14"> |
25 | 676 |
<span class="strong"> |
677 |
<strong> |
|
678 |
//this is not working for me in some cases :( |
|
679 |
</strong> |
|
680 |
</span> |
|
6 | 681 |
</p> |
682 |
<p id="ch11Section_5_15"> |
|
25 | 683 |
To locate a particular file among the archive mention its name after |
684 |
<span class="emphasis"> |
|
685 |
<em> |
|
686 |
t |
|
687 |
</em> |
|
688 |
</span> |
|
689 |
option. |
|
690 |
</p> |
|
691 |
<pre class="programlisting"> |
|
692 |
$ tar t second.txt allfiles.tar |
|
693 |
second.txt |
|
694 |
</pre> |
|
695 |
<p id="ch11Section_5_16"> |
|
696 |
one can also use elementary regex for locating the file, so in previous case even second.* will also return the same result. |
|
6 | 697 |
</p> |
698 |
</div> |
|
25 | 699 |
<div class="section" title="2.2.3.Extracting files from archive:"> |
700 |
<div class="titlepage"> |
|
701 |
<div> |
|
702 |
<div> |
|
703 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
704 |
<a name="id2938183"> |
25 | 705 |
</a> |
706 |
2.2.3.Extracting files from archive: |
|
707 |
</h4> |
|
708 |
</div> |
|
709 |
</div> |
|
710 |
</div> |
|
711 |
<p id="ch11Section_5_17"> |
|
712 |
To extract the content from a archive, use |
|
713 |
<span class="emphasis"> |
|
714 |
<em> |
|
715 |
`x` |
|
716 |
</em> |
|
717 |
</span> |
|
718 |
option: |
|
719 |
</p> |
|
720 |
<pre class="programlisting"> |
|
721 |
$ mkdir extract |
|
722 |
$ cp allfiles.tar extract/ |
|
723 |
$ cd extract |
|
724 |
$ tar -xvf allfiles.tar |
|
725 |
first.txt |
|
726 |
second.txt |
|
727 |
third.txt |
|
728 |
</pre> |
|
729 |
<p id="ch11Section_5_18"> |
|
730 |
To extract any particular file from archive, mention the name of file after |
|
731 |
<span class="emphasis"> |
|
732 |
<em> |
|
733 |
x |
|
734 |
</em> |
|
735 |
</span> |
|
736 |
option: |
|
737 |
</p> |
|
738 |
<pre class="programlisting"> |
|
739 |
$ tar -x second.txt -vf allfiles.tar |
|
740 |
second.txt |
|
741 |
</pre> |
|
742 |
</div> |
|
6 | 743 |
</div> |
25 | 744 |
<div class="section" title="2.3.Further Reading for this section:"> |
745 |
<div class="titlepage"> |
|
746 |
<div> |
|
747 |
<div> |
|
748 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
749 |
<a name="id2938218"> |
25 | 750 |
</a> |
751 |
2.3.Further Reading for this section: |
|
752 |
</h3> |
|
753 |
</div> |
|
754 |
</div> |
|
755 |
</div> |
|
756 |
<div class="itemizedlist"> |
|
757 |
<ul class="itemizedlist" type="*"> |
|
758 |
<li class="listitem" style="list-style-type: *"> |
|
759 |
<p id="ch11Section_5_19"> |
|
760 |
</p> |
|
761 |
<div class="reference"> |
|
762 |
<div class="titlepage"> |
|
763 |
<hr /> |
|
764 |
</div> |
|
765 |
http://en.wikipedia.org/wiki/Tar_(file_format |
|
766 |
</div> |
|
767 |
<p> |
|
768 |
) |
|
769 |
</p> |
|
770 |
</li> |
|
771 |
<li class="listitem" style="list-style-type: *"> |
|
772 |
<p id="ch11Section_5_1a"> |
|
773 |
</p> |
|
774 |
<div class="reference"> |
|
775 |
<div class="titlepage"> |
|
776 |
<hr /> |
|
777 |
</div> |
|
778 |
http://www.gnu.org/software/tar/manual/tar.html |
|
779 |
</div> |
|
780 |
</li> |
|
781 |
<li class="listitem" style="list-style-type: *"> |
|
782 |
<p id="ch11Section_5_1b"> |
|
783 |
</p> |
|
784 |
<div class="reference"> |
|
785 |
<div class="titlepage"> |
|
786 |
<hr /> |
|
787 |
</div> |
|
788 |
http://linuxreviews.org/beginner/ |
|
789 |
</div> |
|
790 |
</li> |
|
791 |
</ul> |
|
792 |
</div> |
|
793 |
</div> |
|
794 |
</div> |
|
795 |
<div class="section" title="3.GZip:"> |
|
796 |
<div class="titlepage"> |
|
797 |
<div> |
|
798 |
<div> |
|
799 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
800 |
<a name="id2938263"> |
25 | 801 |
</a> |
802 |
3.GZip: |
|
803 |
</h2> |
|
804 |
</div> |
|
805 |
</div> |
|
806 |
</div> |
|
807 |
<p id="ch11Section_5_1c"> |
|
808 |
Tar creates archives but it does not compress data by itself unless specified explicitly. Hence all the archive we create using tar command, is simply of the size of total size of all individual files. With Linux there is a compression tool known as |
|
809 |
<span class="emphasis"> |
|
810 |
<em> |
|
811 |
gzip |
|
812 |
</em> |
|
813 |
</span> |
|
814 |
which is used to reduce the size of files mentioned. Whenever possible, each file is replaced by one with the extension .gz', so unlike `tar this command would |
|
815 |
<span class="emphasis"> |
|
816 |
<em> |
|
817 |
replace the existing file |
|
818 |
</em> |
|
819 |
</span> |
|
820 |
. |
|
821 |
</p> |
|
822 |
<div class="section" title="3.1.Get going:"> |
|
6 | 823 |
<div class="titlepage"> |
824 |
<div> |
|
825 |
<div> |
|
826 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
827 |
<a name="id2938288"> |
6 | 828 |
</a> |
25 | 829 |
3.1.Get going: |
830 |
</h3> |
|
831 |
</div> |
|
832 |
</div> |
|
833 |
</div> |
|
834 |
<p id="ch11Section_5_1d"> |
|
835 |
As usual first commands to check out with gzip are |
|
836 |
<span class="emphasis"> |
|
837 |
<em> |
|
838 |
man |
|
839 |
</em> |
|
840 |
</span> |
|
841 |
and |
|
842 |
<span class="emphasis"> |
|
843 |
<em> |
|
844 |
help |
|
845 |
</em> |
|
846 |
</span> |
|
847 |
, |
|
848 |
</p> |
|
849 |
<pre class="programlisting"> |
|
850 |
$ man gzip |
|
851 |
$ gzip --help |
|
852 |
</pre> |
|
853 |
<p id="ch11Section_5_1e"> |
|
854 |
Creating a zip of a bunch of files is fairly trivial, it can be done simply via: |
|
855 |
</p> |
|
856 |
<pre class="programlisting"> |
|
857 |
$ gzip [OPTION]... [FILE]... |
|
858 |
</pre> |
|
859 |
<div class="section" title="3.1.1.Creating zip files:"> |
|
860 |
<div class="titlepage"> |
|
861 |
<div> |
|
862 |
<div> |
|
863 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
864 |
<a name="id2938319"> |
25 | 865 |
</a> |
866 |
3.1.1.Creating zip files: |
|
867 |
</h4> |
|
868 |
</div> |
|
869 |
</div> |
|
870 |
</div> |
|
871 |
<p id="ch11Section_5_1f"> |
|
872 |
Continuing from previous set of files and setup, we will like to zip them and hence the command would be: |
|
873 |
</p> |
|
874 |
<pre class="programlisting"> |
|
875 |
$ gzip first.txt fourth.txt second.txt third.txt |
|
876 |
$ ls |
|
877 |
allfiles.tar first.txt.gz fourth.txt.gz second.txt.gz third.txt.gz zipped.tar.gz |
|
878 |
</pre> |
|
879 |
<p id="ch11Section_5_20"> |
|
880 |
Hence, as mentioned above, all original files are replaced by .gz extension. The above task can also be restated and made easy with help of some common regex expression: |
|
881 |
</p> |
|
882 |
<pre class="programlisting"> |
|
883 |
$ gzip *.txt |
|
884 |
</pre> |
|
885 |
<p id="ch11Section_5_21"> |
|
886 |
Similar to |
|
887 |
<span class="emphasis"> |
|
888 |
<em> |
|
889 |
tar |
|
890 |
</em> |
|
891 |
</span> |
|
892 |
command, one can also use |
|
893 |
<span class="emphasis"> |
|
894 |
<em> |
|
895 |
`-v` |
|
896 |
</em> |
|
897 |
</span> |
|
898 |
option here to see the output in |
|
899 |
<span class="emphasis"> |
|
900 |
<em> |
|
901 |
verbose |
|
902 |
</em> |
|
903 |
</span> |
|
904 |
form. For the previous example, if we enable this option the result would be something like this: |
|
905 |
</p> |
|
906 |
<pre class="programlisting"> |
|
907 |
$ gzip -v *.txt |
|
908 |
first.txt: 4.4% -- replaced with first.txt.gz |
|
909 |
fourth.txt: -7.1% -- replaced with fourth.txt.gz |
|
910 |
second.txt: -4.8% -- replaced with second.txt.gz |
|
911 |
third.txt: 3.8% -- replaced with third.txt.gz |
|
912 |
</pre> |
|
913 |
<p id="ch11Section_5_22"> |
|
914 |
For files of very small sizes and some other cases, one might end up with a zipped file whose size is greater then original file, but compression is always performed(so don't be disheartened in the above case, as files are larger :P). So unlike tar, here all files are zipped separately by default, to make them part of one single chunk one can use some |
|
915 |
<span class="emphasis"> |
|
916 |
<em> |
|
917 |
pipes |
|
918 |
</em> |
|
919 |
</span> |
|
920 |
and |
|
921 |
<span class="emphasis"> |
|
922 |
<em> |
|
923 |
redirections |
|
924 |
</em> |
|
925 |
</span> |
|
926 |
</p> |
|
927 |
<pre class="programlisting"> |
|
928 |
$ gzip -c *.txt > all.gz |
|
929 |
</pre> |
|
930 |
<p id="ch11Section_5_23"> |
|
931 |
Now in this case, all files would be zipped, concatenated and then the output would be written to a file all.gz leaving back all the original files. In the command above |
|
932 |
<span class="emphasis"> |
|
933 |
<em> |
|
934 |
`-c` |
|
935 |
</em> |
|
936 |
</span> |
|
937 |
option states to print the output to standard output(stdout) and following |
|
938 |
<span class="emphasis"> |
|
939 |
<em> |
|
940 |
`>` |
|
941 |
</em> |
|
942 |
</span> |
|
943 |
would redirect the output to file all.gz. So when we decompress this file, we will get a single file named 'all' with all the content of each files concatenated one after the another. |
|
944 |
</p> |
|
945 |
<p id="ch11Section_5_24"> |
|
946 |
For creating a zip archive of a complete directory, one has to use |
|
947 |
<span class="emphasis"> |
|
948 |
<em> |
|
949 |
`-r` |
|
950 |
</em> |
|
951 |
</span> |
|
952 |
options which means recursive, it makes gzip to traverse through all directory tree/structure. By default it will create zip files of each file inside the directory, that is even with the -r flag, gzip still compresses one file at a time : |
|
953 |
</p> |
|
954 |
<pre class="programlisting"> |
|
955 |
$ gzip -r fortune-files/ |
|
956 |
$ gzip -rv . |
|
957 |
./first.txt: 4.4% -- replaced with ./first.txt.gz |
|
958 |
./second.txt: -4.8% -- replaced with ./second.txt.gz |
|
959 |
./third.txt: 3.8% -- replaced with ./third.txt.gz |
|
960 |
./allfiles.tar: 96.6% -- replaced with ./allfiles.tar.gz |
|
961 |
./fourth.txt: -7.1% -- replaced with ./fourth.txt.gz |
|
962 |
</pre> |
|
963 |
<p id="ch11Section_5_25"> |
|
964 |
Hence one always sees files like xxxxx.tar.gz, to create a zip of whole directory in a single file, first archive everything inside a folder and then use gzip on that. For zipping the files using tar itself, one has to use the option |
|
965 |
<span class="emphasis"> |
|
966 |
<em> |
|
967 |
`g` |
|
968 |
</em> |
|
969 |
</span> |
|
970 |
. |
|
971 |
</p> |
|
972 |
<pre class="programlisting"> |
|
973 |
$ tar -cvzf zipped.tar.gz *.txt |
|
974 |
first.txt |
|
975 |
fourth.txt |
|
976 |
second.txt |
|
977 |
third.txt |
|
978 |
</pre> |
|
979 |
<p id="ch11Section_5_26"> |
|
980 |
<span class="emphasis"> |
|
981 |
<em> |
|
982 |
Thats why gzip is designed as a complement to tar, not as a replacement. |
|
983 |
</em> |
|
984 |
</span> |
|
985 |
</p> |
|
986 |
<p id="ch11Section_5_27"> |
|
987 |
gzip command comes with a option |
|
988 |
<span class="emphasis"> |
|
989 |
<em> |
|
990 |
`-l` |
|
991 |
</em> |
|
992 |
</span> |
|
993 |
to view the compressed file contents: |
|
994 |
</p> |
|
995 |
<pre class="programlisting"> |
|
996 |
$ gzip -l zipped.tar.gz |
|
997 |
compressed uncompressed ratio uncompressed_name |
|
998 |
332 10240 97.0% zipped.tar |
|
999 |
</pre> |
|
1000 |
<p id="ch11Section_5_28"> |
|
1001 |
Other feature of gzip is option for mentioning the kind of compression one wants. There is a option of |
|
1002 |
<span class="emphasis"> |
|
1003 |
<em> |
|
1004 |
`-n` |
|
1005 |
</em> |
|
1006 |
</span> |
|
1007 |
where |
|
1008 |
<span class="emphasis"> |
|
1009 |
<em> |
|
1010 |
n varies from 0 to 9 |
|
1011 |
</em> |
|
1012 |
</span> |
|
1013 |
which regulate the speed/quality of compression. With |
|
1014 |
<span class="emphasis"> |
|
1015 |
<em> |
|
1016 |
`-1` |
|
1017 |
</em> |
|
1018 |
</span> |
|
1019 |
or |
|
1020 |
<span class="emphasis"> |
|
1021 |
<em> |
|
1022 |
`--fast` |
|
1023 |
</em> |
|
1024 |
</span> |
|
1025 |
option it means the fastest compression method (less compression) and |
|
1026 |
<span class="emphasis"> |
|
1027 |
<em> |
|
1028 |
`--best` |
|
1029 |
</em> |
|
1030 |
</span> |
|
1031 |
or |
|
1032 |
<span class="emphasis"> |
|
1033 |
<em> |
|
1034 |
`-9` |
|
1035 |
</em> |
|
1036 |
</span> |
|
1037 |
indicates the slowest compression method, default compression level is |
|
1038 |
<span class="emphasis"> |
|
1039 |
<em> |
|
1040 |
`-6` |
|
1041 |
</em> |
|
1042 |
</span> |
|
1043 |
. |
|
1044 |
</p> |
|
1045 |
<p id="ch11Section_5_29"> |
|
1046 |
To decompress a already compressed file there are two options, either use |
|
1047 |
<span class="emphasis"> |
|
1048 |
<em> |
|
1049 |
`gunzip` |
|
1050 |
</em> |
|
1051 |
</span> |
|
1052 |
command or use |
|
1053 |
<span class="emphasis"> |
|
1054 |
<em> |
|
1055 |
`-d` |
|
1056 |
</em> |
|
1057 |
</span> |
|
1058 |
option with gzip command: |
|
1059 |
</p> |
|
1060 |
<pre class="programlisting"> |
|
1061 |
$ gzip -dv *.gz |
|
1062 |
all.gz: -440.4% -- replaced with all |
|
1063 |
first.txt.gz: 4.4% -- replaced with first.txt |
|
1064 |
fourth.txt.gz: -7.1% -- replaced with fourth.txt |
|
1065 |
second.txt.gz: -4.8% -- replaced with second.txt |
|
1066 |
third.txt.gz: 3.8% -- replaced with third.txt |
|
1067 |
zipped.tar.gz: 97.0% -- replaced with zipped.tar |
|
1068 |
</pre> |
|
1069 |
<p id="ch11Section_5_2a"> |
|
1070 |
or: |
|
1071 |
</p> |
|
1072 |
<pre class="programlisting"> |
|
1073 |
$ gunzip -v *.gz |
|
1074 |
</pre> |
|
1075 |
<p id="ch11Section_5_2b"> |
|
1076 |
Both of those commands will give the same result. So here one can notice the content of file "all" which we created earlier, it will have content of all the rest of four files concatenated one after another, but "zipped.tar.gz" is zip of tar of all files, will effectively have zip of archives of all files separately, and hence the usage and importance of |
|
1077 |
<span class="emphasis"> |
|
1078 |
<em> |
|
1079 |
tar |
|
1080 |
</em> |
|
1081 |
</span> |
|
1082 |
. |
|
1083 |
</p> |
|
1084 |
</div> |
|
1085 |
</div> |
|
1086 |
<div class="section" title="3.2.Further Reading for this section:"> |
|
1087 |
<div class="titlepage"> |
|
1088 |
<div> |
|
1089 |
<div> |
|
1090 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1091 |
<a name="id2938542"> |
25 | 1092 |
</a> |
1093 |
3.2.Further Reading for this section: |
|
6 | 1094 |
</h3> |
1095 |
</div> |
|
1096 |
</div> |
|
1097 |
</div> |
|
1098 |
<div class="itemizedlist"> |
|
1099 |
<ul class="itemizedlist" type="*"> |
|
1100 |
<li class="listitem" style="list-style-type: *"> |
|
25 | 1101 |
<p id="ch11Section_5_2c"> |
6 | 1102 |
</p> |
25 | 1103 |
<div class="reference"> |
1104 |
<div class="titlepage"> |
|
1105 |
<hr /> |
|
1106 |
</div> |
|
1107 |
http://linuxreviews.org/beginner/ |
|
1108 |
</div> |
|
6 | 1109 |
</li> |
25 | 1110 |
<li class="listitem" style="list-style-type: *"> |
1111 |
<p id="ch11Section_5_2d"> |
|
1112 |
</p> |
|
1113 |
<div class="reference"> |
|
1114 |
<div class="titlepage"> |
|
1115 |
<hr /> |
|
1116 |
</div> |
|
1117 |
http://lowfatlinux.com/linux-gzip-gunzip.html |
|
1118 |
</div> |
|
1119 |
</li> |
|
6 | 1120 |
<li class="listitem" style="list-style-type: *"> |
25 | 1121 |
<p id="ch11Section_5_2e"> |
6 | 1122 |
</p> |
25 | 1123 |
<div class="reference"> |
1124 |
<div class="titlepage"> |
|
1125 |
<hr /> |
|
1126 |
</div> |
|
1127 |
http://www.gnu.org/software/gzip/manual/gzip.html |
|
1128 |
</div> |
|
6 | 1129 |
</li> |
1130 |
<li class="listitem" style="list-style-type: *"> |
|
25 | 1131 |
<p id="ch11Section_5_2f"> |
1132 |
</p> |
|
1133 |
<div class="reference"> |
|
1134 |
<div class="titlepage"> |
|
1135 |
<hr /> |
|
1136 |
</div> |
|
1137 |
http://en.wikipedia.org/wiki/ZIP_(file_format |
|
1138 |
</div> |
|
1139 |
<p> |
|
1140 |
) |
|
6 | 1141 |
</p> |
1142 |
</li> |
|
1143 |
</ul> |
|
1144 |
</div> |
|
1145 |
</div> |
|
1146 |
</div> |
|
25 | 1147 |
<div class="section" title="4.File Comparisons:"> |
6 | 1148 |
<div class="titlepage"> |
1149 |
<div> |
|
1150 |
<div> |
|
1151 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1152 |
<a name="id2938596"> |
6 | 1153 |
</a> |
25 | 1154 |
4.File Comparisons: |
6 | 1155 |
</h2> |
1156 |
</div> |
|
1157 |
</div> |
|
1158 |
</div> |
|
25 | 1159 |
<p id="ch11Section_5_30"> |
1160 |
Linux based distributions also have some utilities for checking the content of files, comparing them very quickly to other files. These operations can be looking for differences/similarities. Some of the commands which prove handy are: |
|
1161 |
</p> |
|
1162 |
<div class="section" title="4.1.cmp:"> |
|
6 | 1163 |
<div class="titlepage"> |
1164 |
<div> |
|
1165 |
<div> |
|
1166 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1167 |
<a name="id2938613"> |
6 | 1168 |
</a> |
25 | 1169 |
4.1.cmp: |
6 | 1170 |
</h3> |
1171 |
</div> |
|
1172 |
</div> |
|
1173 |
</div> |
|
1174 |
<p id="ch11Section_5_31"> |
|
25 | 1175 |
If one wants to compare two files whether they are same or not, one can use this handy tool. Let us consider some situation, we run find/locate command to locate some file, and it turns out that we have a file with same name in different location, and in case we want to run a quick check on there content, cmp is the right tool. For my system I perform these tasks to illustrate the use of this command: |
1176 |
</p> |
|
1177 |
<pre class="programlisting"> |
|
1178 |
$ find . -name quick.c |
|
1179 |
./Desktop/programs/quick.c |
|
1180 |
./c-folder/quick.c |
|
1181 |
$ cmp Desktop/programs/quick.c c-folder/quick.c |
|
1182 |
$ |
|
1183 |
</pre> |
|
1184 |
<p id="ch11Section_5_32"> |
|
1185 |
For me it returns nothing, hence that means both the files are exact copy of each other, by default, cmp is silent if the files are the same. Make some changes in one of the file and rerun the command. For me it works like this: |
|
1186 |
</p> |
|
1187 |
<pre class="programlisting"> |
|
1188 |
$ cmp Desktop/programs/quick.c c-folder/quick.c |
|
1189 |
Desktop/programs/quick.c c-folder/quick.c differ: byte 339, line 24 |
|
1190 |
</pre> |
|
1191 |
<p id="ch11Section_5_33"> |
|
1192 |
That is, if files differ, the byte and line number at which the first difference occurred is reported. |
|
1193 |
</p> |
|
1194 |
</div> |
|
1195 |
<div class="section" title="4.2.diff:"> |
|
1196 |
<div class="titlepage"> |
|
1197 |
<div> |
|
1198 |
<div> |
|
1199 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1200 |
<a name="id2938655"> |
25 | 1201 |
</a> |
1202 |
4.2.diff: |
|
1203 |
</h3> |
|
1204 |
</div> |
|
1205 |
</div> |
|
1206 |
</div> |
|
1207 |
<p id="ch11Section_5_34"> |
|
1208 |
Now there are situations when one wants to exactly know the differences among two files, for them, GNU diff can show whether files are different without detailing the differences. For simple and basic usage of this programs, consider following example: |
|
1209 |
</p> |
|
1210 |
<pre class="programlisting"> |
|
1211 |
$ echo -e "quick nbrown nfox njumped nover nthe nlazy ndog" > allcharacters.txt |
|
1212 |
$ echo -e "quick nbrown nfox njmuped nover nteh nlzay ndog" > problem.txt |
|
1213 |
$ diff problem.txt allcharacters.txt |
|
1214 |
4c4 |
|
1215 |
< jmuped |
|
1216 |
--- |
|
1217 |
> jumped |
|
1218 |
6,7c6,7 |
|
1219 |
< teh |
|
1220 |
< lzay |
|
1221 |
--- |
|
1222 |
> the |
|
1223 |
> lazy |
|
1224 |
</pre> |
|
1225 |
<p id="ch11Section_5_35"> |
|
1226 |
Looking at results above mentioned it is very trivial to deduce that, diff if used on two separate text files will result in line by line results for all the lines which are different. So most common use case scenario can be, got some files in various location of system with same name and size, just run diff through them and remove all the redundant files. Other similar command which one can find more effective for this can be |
|
6 | 1227 |
<span class="emphasis"> |
1228 |
<em> |
|
25 | 1229 |
sdiff |
6 | 1230 |
</em> |
1231 |
</span> |
|
25 | 1232 |
, for the same files using sdiff will result in: |
6 | 1233 |
</p> |
25 | 1234 |
<pre class="programlisting"> |
1235 |
$ sdiff problem.txt allcharacters.txt |
|
1236 |
quick quick |
|
1237 |
brown brown |
|
1238 |
fox fox |
|
1239 |
jmuped | jumped |
|
1240 |
over over |
|
1241 |
teh | the |
|
1242 |
lzay | lazy |
|
1243 |
dog dog |
|
1244 |
</pre> |
|
1245 |
<p id="ch11Section_5_36"> |
|
1246 |
Some exercise for a change: |
|
6 | 1247 |
</p> |
15 | 1248 |
<div class="itemizedlist"> |
1249 |
<ul class="itemizedlist" type="*"> |
|
1250 |
<li class="listitem" style="list-style-type: *"> |
|
1251 |
<p id="ch11Section_5_37"> |
|
25 | 1252 |
Try using diff for any binary file, does it work? |
15 | 1253 |
</p> |
1254 |
</li> |
|
1255 |
<li class="listitem" style="list-style-type: *"> |
|
1256 |
<p id="ch11Section_5_38"> |
|
25 | 1257 |
What are other equivalent for diff command based on needs/requirements? |
15 | 1258 |
</p> |
1259 |
</li> |
|
1260 |
<li class="listitem" style="list-style-type: *"> |
|
1261 |
<p id="ch11Section_5_39"> |
|
25 | 1262 |
Can we use diff to compare two directories? If yes how? |
15 | 1263 |
</p> |
1264 |
</li> |
|
1265 |
</ul> |
|
1266 |
</div> |
|
6 | 1267 |
</div> |
25 | 1268 |
<div class="section" title="4.3.comm:"> |
6 | 1269 |
<div class="titlepage"> |
1270 |
<div> |
|
1271 |
<div> |
|
1272 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1273 |
<a name="id2938737"> |
6 | 1274 |
</a> |
25 | 1275 |
4.3.comm: |
6 | 1276 |
</h3> |
1277 |
</div> |
|
1278 |
</div> |
|
1279 |
</div> |
|
25 | 1280 |
<p id="ch11Section_5_3a"> |
1281 |
This is one more command which proves handy at times, the short and sweet man page states "compare two sorted files line by line". Or this it compares sorted files and selects or rejects lines common to two files. For ex: |
|
6 | 1282 |
</p> |
1283 |
<pre class="programlisting"> |
|
25 | 1284 |
$ sort allcharacters.txt>sortedcharac.txt; sort problem.txt>sortedprob.txt |
1285 |
$ comm sortedcharac.txt sortedprob.txt |
|
1286 |
brown |
|
1287 |
dog |
|
1288 |
fox |
|
1289 |
jmuped |
|
1290 |
jumped |
|
1291 |
lazy |
|
1292 |
lzay |
|
1293 |
over |
|
1294 |
quick |
|
1295 |
teh |
|
1296 |
the |
|
6 | 1297 |
</pre> |
25 | 1298 |
</div> |
1299 |
</div> |
|
1300 |
<div class="section" title="5.Environment Variables:"> |
|
1301 |
<div class="titlepage"> |
|
1302 |
<div> |
|
1303 |
<div> |
|
1304 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1305 |
<a name="id2938767"> |
25 | 1306 |
</a> |
1307 |
5.Environment Variables: |
|
1308 |
</h2> |
|
1309 |
</div> |
|
1310 |
</div> |
|
6 | 1311 |
</div> |
25 | 1312 |
<p id="ch11Section_5_3b"> |
1313 |
These variables like HOME, OSTYPE,Variables are a way of passing information from the shell to programs when you run them. Programs look "in the environment" for particular variables and if they are found will use the values stored. Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session.By convention, environment variables have UPPER CASE and shell variables have lower case names. |
|
1314 |
</p> |
|
1315 |
<p id="ch11Section_5_3c"> |
|
1316 |
Some of examples of Environment variables are(result may vary!): |
|
1317 |
</p> |
|
1318 |
<pre class="programlisting"> |
|
1319 |
$ echo $OSTYPE |
|
1320 |
linux-gnu |
|
1321 |
$ echo $HOME |
|
1322 |
/home/baali |
|
1323 |
</pre> |
|
1324 |
<p id="ch11Section_5_3d"> |
|
1325 |
To see all the variables and there values use any of following commands: |
|
1326 |
</p> |
|
1327 |
<pre class="programlisting"> |
|
1328 |
$ printenv | less |
|
1329 |
$ env |
|
1330 |
</pre> |
|
1331 |
<p id="ch11Section_5_3e"> |
|
1332 |
The most commonly used environment variable is "PATH", it defines a list of directories to search through when looking for a command to execute. If you decide to put your own programs in a bin directory under your home directory, you'll have to modify the path to include that directory, or the system will never find your programs (unless you happen to be in that directory when you enter the command). Here's how to change your PATH variable so it includes your personal bin directory: |
|
1333 |
</p> |
|
1334 |
<pre class="programlisting"> |
|
1335 |
$ set PATH=$PATH:$HOME/bin |
|
1336 |
</pre> |
|
1337 |
<p id="ch11Section_5_3f"> |
|
1338 |
See the difference in value of PATH variable before and after modifying it. One can also create its own variable to make things easier: |
|
1339 |
</p> |
|
1340 |
<pre class="programlisting"> |
|
1341 |
$ set repo = $HOME/Desktop/random/code |
|
1342 |
$ cd $repo |
|
1343 |
</pre> |
|
1344 |
<p id="ch11Section_5_40"> |
|
1345 |
<span class="emphasis"> |
|
1346 |
<em> |
|
1347 |
set |
|
1348 |
</em> |
|
1349 |
</span> |
|
1350 |
command is used to define a variable for the current shell. Try opening a new shell and use the above mentioned command, it wont work as expected. The other child process wont be able to see these variables unless we |
|
1351 |
<span class="emphasis"> |
|
1352 |
<em> |
|
1353 |
export |
|
1354 |
</em> |
|
1355 |
</span> |
|
1356 |
them. Repeat the above mentioned activity with |
|
1357 |
<span class="emphasis"> |
|
1358 |
<em> |
|
1359 |
export |
|
1360 |
</em> |
|
1361 |
</span> |
|
1362 |
command. Now with all new shells, |
|
1363 |
<span class="emphasis"> |
|
1364 |
<em> |
|
1365 |
$repo |
|
1366 |
</em> |
|
1367 |
</span> |
|
1368 |
will work. |
|
1369 |
</p> |
|
1370 |
<p id="ch11Section_5_41"> |
|
1371 |
Again these changes are limited to current session. To make them permanent or get loaded each time you log in, just add those lines to |
|
1372 |
<span class="emphasis"> |
|
1373 |
<em> |
|
1374 |
.bashrc |
|
1375 |
</em> |
|
1376 |
</span> |
|
1377 |
file. |
|
1378 |
</p> |
|
1379 |
<div class="section" title="5.1.Further Reading:"> |
|
6 | 1380 |
<div class="titlepage"> |
1381 |
<div> |
|
1382 |
<div> |
|
1383 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1384 |
<a name="id2938866"> |
6 | 1385 |
</a> |
25 | 1386 |
5.1.Further Reading: |
6 | 1387 |
</h3> |
1388 |
</div> |
|
1389 |
</div> |
|
1390 |
</div> |
|
25 | 1391 |
<div class="itemizedlist"> |
1392 |
<ul class="itemizedlist" type="*"> |
|
1393 |
<li class="listitem" style="list-style-type: *"> |
|
1394 |
<p id="ch11Section_5_42"> |
|
1395 |
</p> |
|
1396 |
<div class="reference"> |
|
1397 |
<div class="titlepage"> |
|
1398 |
<hr /> |
|
1399 |
</div> |
|
1400 |
http://lowfatlinux.com/linux-environment-variables.html |
|
1401 |
</div> |
|
1402 |
</li> |
|
1403 |
<li class="listitem" style="list-style-type: *"> |
|
1404 |
<p id="ch11Section_5_43"> |
|
1405 |
</p> |
|
1406 |
<div class="reference"> |
|
1407 |
<div class="titlepage"> |
|
1408 |
<hr /> |
|
1409 |
</div> |
|
1410 |
http://www.codecoffee.com/tipsforlinux/articles/030.html |
|
6 | 1411 |
</div> |
25 | 1412 |
</li> |
1413 |
<li class="listitem" style="list-style-type: *"> |
|
1414 |
<p id="ch11Section_5_44"> |
|
1415 |
</p> |
|
1416 |
<div class="reference"> |
|
1417 |
<div class="titlepage"> |
|
1418 |
<hr /> |
|
1419 |
</div> |
|
1420 |
http://www.ee.surrey.ac.uk/Teaching/Unix/unix8.html |
|
6 | 1421 |
</div> |
25 | 1422 |
</li> |
1423 |
<li class="listitem" style="list-style-type: *"> |
|
1424 |
<p id="ch11Section_5_45"> |
|
1425 |
</p> |
|
1426 |
<div class="reference"> |
|
1427 |
<div class="titlepage"> |
|
1428 |
<hr /> |
|
6 | 1429 |
</div> |
25 | 1430 |
http://en.wikipedia.org/wiki/Environment_variable |
1431 |
</div> |
|
1432 |
</li> |
|
1433 |
</ul> |
|
6 | 1434 |
</div> |
1435 |
</div> |
|
1436 |
</div> |
|
25 | 1437 |
<div class="section" title="6.Shell Scripting:"> |
6 | 1438 |
<div class="titlepage"> |
1439 |
<div> |
|
1440 |
<div> |
|
1441 |
<h2 class="title" style="clear: both"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1442 |
<a name="id2938921"> |
6 | 1443 |
</a> |
25 | 1444 |
6.Shell Scripting: |
6 | 1445 |
</h2> |
1446 |
</div> |
|
1447 |
</div> |
|
1448 |
</div> |
|
25 | 1449 |
<div class="section" title="6.1.Basics:"> |
6 | 1450 |
<div class="titlepage"> |
1451 |
<div> |
|
1452 |
<div> |
|
1453 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1454 |
<a name="id2938929"> |
6 | 1455 |
</a> |
25 | 1456 |
6.1.Basics: |
6 | 1457 |
</h3> |
1458 |
</div> |
|
1459 |
</div> |
|
1460 |
</div> |
|
25 | 1461 |
<p id="ch11Section_5_46"> |
1462 |
Shell program or shell script,a sequence of commands to a text file and tell the shell to execute the text file instead of entering the commands. The first |
|
6 | 1463 |
<span class="emphasis"> |
1464 |
<em> |
|
25 | 1465 |
"Hello World" |
6 | 1466 |
</em> |
1467 |
</span> |
|
25 | 1468 |
sample for shell scripting is as easy as it sounds: |
6 | 1469 |
</p> |
1470 |
<pre class="programlisting"> |
|
25 | 1471 |
$ echo '#!/bin/sh' > my-script.sh |
1472 |
$ clear >> my-script.sh |
|
1473 |
$ echo 'echo Hello World' >> my-script.sh |
|
1474 |
$ chmod 755 my-script.sh |
|
1475 |
$ ./my-script.sh |
|
1476 |
Hello World |
|
6 | 1477 |
</pre> |
25 | 1478 |
<p id="ch11Section_5_47"> |
1479 |
The #! syntax(also known as shebang) is used in scripts to indicate an interpreter for execution under UNIX / Linux operating systems. The chmod is required to make the script executable. This script will just execute two commands, |
|
6 | 1480 |
<span class="emphasis"> |
1481 |
<em> |
|
25 | 1482 |
clear |
6 | 1483 |
</em> |
1484 |
</span> |
|
1485 |
and |
|
1486 |
<span class="emphasis"> |
|
1487 |
<em> |
|
25 | 1488 |
echo |
6 | 1489 |
</em> |
1490 |
</span> |
|
25 | 1491 |
one after another. One can also do the same task using a one liner command |
6 | 1492 |
<span class="emphasis"> |
1493 |
<em> |
|
25 | 1494 |
clear; echo 'Hello World'; |
6 | 1495 |
</em> |
1496 |
</span> |
|
25 | 1497 |
but as number of lines grows using a script file is helpful. |
6 | 1498 |
</p> |
25 | 1499 |
<p id="ch11Section_5_48"> |
1500 |
So lets create a script which gives us all the filenames for given initial alphabet or string in a directory. Let the name of script be |
|
1501 |
<span class="emphasis"> |
|
1502 |
<em> |
|
1503 |
initial.sh |
|
1504 |
</em> |
|
1505 |
</span> |
|
1506 |
, open it with text editor, and write: |
|
6 | 1507 |
</p> |
1508 |
<pre class="programlisting"> |
|
25 | 1509 |
#!/bin/sh |
1510 |
ls > temp |
|
1511 |
grep ^$1 < temp |
|
1512 |
rm temp |
|
1513 |
$ chmod a+x initial.sh |
|
1514 |
$ ./initial.sh s |
|
6 | 1515 |
</pre> |
25 | 1516 |
<p id="ch11Section_5_49"> |
1517 |
The $1 in the script is pertaining to command line argument. All arguments passed via command line are accessed via |
|
1518 |
<span class="emphasis"> |
|
1519 |
<em> |
|
1520 |
$# |
|
1521 |
</em> |
|
1522 |
</span> |
|
1523 |
with name of script being first member, that is $0. Now lets write a script for finding a file, and then checking when was it last modified: |
|
6 | 1524 |
</p> |
25 | 1525 |
<pre class="programlisting"> |
1526 |
#!/bin/sh |
|
1527 |
name=`find . -name $1 -print` |
|
1528 |
echo $name |
|
1529 |
last_modified=`stat -c %y $name| cut -f 1 -d " "` |
|
1530 |
echo "Last modified: $last_modified" |
|
1531 |
$ ./search.sh fname |
|
1532 |
</pre> |
|
1533 |
<p id="ch11Section_5_4a"> |
|
1534 |
Try giving some file you want to search in place of fname. Please note in second line |
|
1535 |
<span class="emphasis"> |
|
1536 |
<em> |
|
1537 |
` |
|
1538 |
</em> |
|
1539 |
</span> |
|
1540 |
its a back-quote(other key mapped with tilda), it is specifically used to get the output of one command into a variable. In this particular case name is a User defined variables (UDV) which stores the value. We access value stored in any variable using |
|
1541 |
<span class="emphasis"> |
|
1542 |
<em> |
|
1543 |
$ |
|
1544 |
</em> |
|
1545 |
</span> |
|
1546 |
symbol before name of variable. |
|
1547 |
</p> |
|
1548 |
<p id="ch11Section_5_4b"> |
|
1549 |
naming conventions for variables?? do we need them?? |
|
1550 |
</p> |
|
6 | 1551 |
</div> |
25 | 1552 |
<div class="section" title="6.2.Shell Arithmetic:"> |
6 | 1553 |
<div class="titlepage"> |
1554 |
<div> |
|
1555 |
<div> |
|
1556 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1557 |
<a name="id2937287"> |
6 | 1558 |
</a> |
25 | 1559 |
6.2.Shell Arithmetic: |
6 | 1560 |
</h3> |
1561 |
</div> |
|
1562 |
</div> |
|
1563 |
</div> |
|
25 | 1564 |
<p id="ch11Section_5_4c"> |
1565 |
Shell also provides support for basic arithmetic operations. The syntax is: |
|
1566 |
</p> |
|
1567 |
<pre class="programlisting"> |
|
1568 |
$ expr op1 math-operator op2 |
|
1569 |
</pre> |
|
1570 |
<p id="ch11Section_5_4d"> |
|
1571 |
Some of example which can be tried handily: |
|
6 | 1572 |
</p> |
25 | 1573 |
<pre class="programlisting"> |
1574 |
$ expr -3 + 5 |
|
1575 |
2 |
|
1576 |
$ expr 10 % 3 |
|
1577 |
1 |
|
1578 |
</pre> |
|
1579 |
<p id="ch11Section_5_4e"> |
|
1580 |
These spaces in between operator and operands is important, without them shell interpreter will raise the syntax error. |
|
6 | 1581 |
</p> |
1582 |
<pre class="programlisting"> |
|
25 | 1583 |
$ expr 2*3 |
1584 |
expr: syntax error |
|
6 | 1585 |
</pre> |
25 | 1586 |
<p id="ch11Section_5_4f"> |
1587 |
One can use back-quotes(`) also to get value of expr. |
|
1588 |
</p> |
|
1589 |
<pre class="programlisting"> |
|
1590 |
$ echo `expr 6 + 3` |
|
1591 |
9 |
|
1592 |
$ result=`expr 6 + 3` |
|
1593 |
$ echo $result |
|
1594 |
9 |
|
1595 |
</pre> |
|
1596 |
<p id="ch11Section_5_50"> |
|
1597 |
Shell uses three kinds of quotes. Double quotes("), anything enclosed among them except from variable trailing after $, and characters after would be printed as it is. Single quotes('), anything enclosed within them is just same, no formulation/interpretation. Back quotes(`), anything inclosed is considered as command, or is executed. |
|
6 | 1598 |
</p> |
25 | 1599 |
<pre class="programlisting"> |
1600 |
$ echo "Today is date" |
|
1601 |
Today is date |
|
1602 |
$ echo "Today is `date`" |
|
1603 |
Today is Wed Sep 16 17:32:22 IST 2009 |
|
1604 |
$ echo 'Today is `date`' |
|
1605 |
Today is `date` |
|
1606 |
$ echo "Today is n `date`" |
|
1607 |
Today is n Wed Sep 16 17:40:13 IST 2009 |
|
1608 |
$ echo -e "Today is n `date`" |
|
1609 |
Today is |
|
1610 |
Wed Sep 16 17:41:13 IST 2009 |
|
1611 |
</pre> |
|
6 | 1612 |
</div> |
25 | 1613 |
<div class="section" title="6.3.if else construct:"> |
6 | 1614 |
<div class="titlepage"> |
1615 |
<div> |
|
1616 |
<div> |
|
1617 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1618 |
<a name="id2939306"> |
6 | 1619 |
</a> |
25 | 1620 |
6.3.if else construct: |
6 | 1621 |
</h3> |
1622 |
</div> |
|
1623 |
</div> |
|
1624 |
</div> |
|
25 | 1625 |
<p id="ch11Section_5_51"> |
1626 |
One can have simple |
|
1627 |
<span class="emphasis"> |
|
1628 |
<em> |
|
1629 |
if else if |
|
1630 |
</em> |
|
1631 |
</span> |
|
1632 |
constructs in shell scripts to check conditions. Lets take simple example of writing a script which returns back whether the argument passed is positive or not: |
|
1633 |
</p> |
|
1634 |
<pre class="programlisting"> |
|
1635 |
#!/bin/sh |
|
1636 |
if test $1 -gt 0 |
|
1637 |
then |
|
1638 |
echo "number is positive" |
|
1639 |
else |
|
1640 |
echo "number is negative" |
|
1641 |
fi |
|
1642 |
$ ./sign.sh -11 |
|
1643 |
number is negative |
|
1644 |
</pre> |
|
1645 |
<p id="ch11Section_5_52"> |
|
1646 |
This script will compare the first value passed as argument with 0 |
|
6 | 1647 |
<span class="emphasis"> |
1648 |
<em> |
|
25 | 1649 |
if test var -gt val |
1650 |
</em> |
|
1651 |
</span> |
|
1652 |
, var being $1 and val being 0, gt meaning greater then. Now this program has some flaw, it will give same result for following input: (-11) and (-1, 5), as we are checking just $1 which is first argument and hence the result. For handling such situation we can include |
|
1653 |
<span class="emphasis"> |
|
1654 |
<em> |
|
1655 |
if-else |
|
1656 |
</em> |
|
1657 |
</span> |
|
1658 |
clause which will warn user of correct usage of script. |
|
1659 |
</p> |
|
1660 |
<pre class="programlisting"> |
|
1661 |
#this is the case when no argument is passed |
|
1662 |
if [ $# -eq 0 ] |
|
1663 |
then |
|
1664 |
echo "$0 : You must give/supply one integers" |
|
1665 |
exit 1 |
|
1666 |
else |
|
1667 |
if [ $# -gt 1 ] |
|
1668 |
then |
|
1669 |
echo "$0 : You must give one integer" |
|
1670 |
exit 1 |
|
1671 |
fi |
|
1672 |
fi |
|
1673 |
</pre> |
|
1674 |
<p id="ch11Section_5_53"> |
|
1675 |
One important thing to not in shell script is spacing, with many comparison and evaluation operation a wrongly placed space will spoil all the fun. So in previous example the expression |
|
1676 |
<span class="emphasis"> |
|
1677 |
<em> |
|
1678 |
[ $# -eq 0 ] |
|
6 | 1679 |
</em> |
1680 |
</span> |
|
25 | 1681 |
will work properly, but if we remove those leading or trailing spaces like |
1682 |
<span class="emphasis"> |
|
1683 |
<em> |
|
1684 |
[ $# -eq 0] |
|
1685 |
</em> |
|
1686 |
</span> |
|
1687 |
, it wont work as expected, or rather throw a warning. Both |
|
1688 |
<span class="emphasis"> |
|
1689 |
<em> |
|
1690 |
test |
|
1691 |
</em> |
|
1692 |
</span> |
|
1693 |
and |
|
1694 |
<span class="emphasis"> |
|
1695 |
<em> |
|
1696 |
[] |
|
1697 |
</em> |
|
1698 |
</span> |
|
1699 |
do the same task of testing a expression and returning true or false. |
|
6 | 1700 |
</p> |
25 | 1701 |
<p id="ch11Section_5_54"> |
1702 |
Lets create something interesting using these if-else clause. Now we will create a script which will greet the user when he opens the shell. We will create the script, change the permission to make it executable and append the |
|
1703 |
<span class="emphasis"> |
|
1704 |
<em> |
|
1705 |
.bashrc |
|
1706 |
</em> |
|
1707 |
</span> |
|
1708 |
file with |
|
1709 |
<span class="emphasis"> |
|
1710 |
<em> |
|
1711 |
./greet.sh |
|
1712 |
</em> |
|
1713 |
</span> |
|
1714 |
line and we are done. The script is: |
|
1715 |
</p> |
|
1716 |
<pre class="programlisting"> |
|
1717 |
#!/bin/sh |
|
1718 |
#Script to greet the user according to time of day |
|
1719 |
temph=`date | cut -c12-13` |
|
1720 |
dat=`date +"%A %d in %B of %Y (%r)"` |
|
1721 |
if [ $temph -lt 12 ] |
|
1722 |
then |
|
1723 |
mess="Good Morning $LOGNAME, Have a nice day!" |
|
1724 |
fi |
|
1725 |
||
1726 |
if [ $temph -gt 12 -a $temph -le 16 ] |
|
1727 |
then |
|
1728 |
mess="Good Afternoon $LOGNAME" |
|
1729 |
fi |
|
1730 |
||
1731 |
if [ $temph -gt 16 -a $temph -le 18 ] |
|
1732 |
then |
|
1733 |
mess="Good Evening $LOGNAME" |
|
1734 |
fi |
|
1735 |
echo -e "$mess nThis is $dat" |
|
1736 |
</pre> |
|
1737 |
<p id="ch11Section_5_55"> |
|
1738 |
For me when I open the shell the output is something like: |
|
1739 |
</p> |
|
1740 |
<pre class="programlisting"> |
|
1741 |
Good Morning baali, Have a nice day! |
|
1742 |
This is Wednesday 16 in September of 2009 (11:54:47 AM IST) |
|
1743 |
</pre> |
|
6 | 1744 |
</div> |
25 | 1745 |
<div class="section" title="6.4.Loops"> |
6 | 1746 |
<div class="titlepage"> |
1747 |
<div> |
|
1748 |
<div> |
|
1749 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1750 |
<a name="id2939412"> |
6 | 1751 |
</a> |
25 | 1752 |
6.4.Loops |
6 | 1753 |
</h3> |
1754 |
</div> |
|
1755 |
</div> |
|
1756 |
</div> |
|
25 | 1757 |
<p id="ch11Section_5_56"> |
1758 |
Bash has three different commands for looping -- |
|
1759 |
<code class="literal"> |
|
1760 |
for |
|
1761 |
</code> |
|
1762 |
, |
|
1763 |
<code class="literal"> |
|
1764 |
while |
|
1765 |
</code> |
|
1766 |
and |
|
1767 |
<code class="literal"> |
|
1768 |
until |
|
1769 |
</code> |
|
1770 |
. |
|
6 | 1771 |
</p> |
25 | 1772 |
<div class="section" title="6.4.1.for loop"> |
6 | 1773 |
<div class="titlepage"> |
1774 |
<div> |
|
1775 |
<div> |
|
1776 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1777 |
<a name="id2939434"> |
6 | 1778 |
</a> |
25 | 1779 |
6.4.1. |
1780 |
<code class="literal"> |
|
1781 |
for |
|
1782 |
</code> |
|
1783 |
loop |
|
6 | 1784 |
</h4> |
1785 |
</div> |
|
1786 |
</div> |
|
1787 |
</div> |
|
25 | 1788 |
<p id="ch11Section_5_57"> |
1789 |
Suppose we have a set of files, that have names beginning with numbers followed by their names - |
|
1790 |
<code class="literal"> |
|
1791 |
08 - Society.mp3 |
|
1792 |
</code> |
|
1793 |
. We would like to rename these files to remove the numbering. How would we go about doing that? It is clear from the problem statement that we could use a |
|
1794 |
<code class="literal"> |
|
1795 |
for |
|
1796 |
</code> |
|
1797 |
loop, to loop through the list of files and rename each of the files. |
|
1798 |
</p> |
|
1799 |
<p id="ch11Section_5_58"> |
|
1800 |
Let's first look at a simple |
|
1801 |
<code class="literal"> |
|
1802 |
for |
|
1803 |
</code> |
|
1804 |
loop, to understand how it works. |
|
1805 |
</p> |
|
1806 |
<pre class="programlisting"> |
|
1807 |
for animal in rat cat dog man |
|
1808 |
do |
|
1809 |
echo $animal |
|
1810 |
done |
|
1811 |
</pre> |
|
1812 |
<p id="ch11Section_5_59"> |
|
1813 |
We just wrote a list of animals, each animal's name separated by a space and printed each name on a separate line. The variable |
|
1814 |
<code class="literal"> |
|
1815 |
animal |
|
1816 |
</code> |
|
1817 |
is a dummy variable and has no significance. You could use something as lame as |
|
1818 |
<code class="literal"> |
|
1819 |
i |
|
1820 |
</code> |
|
1821 |
in place of |
|
1822 |
<code class="literal"> |
|
1823 |
animal |
|
1824 |
</code> |
|
1825 |
. |
|
1826 |
</p> |
|
1827 |
<p id="ch11Section_5_5a"> |
|
1828 |
Now, we use a simple |
|
1829 |
<code class="literal"> |
|
1830 |
for |
|
1831 |
</code> |
|
1832 |
loop to list the files that we are interested in. |
|
6 | 1833 |
</p> |
1834 |
<pre class="programlisting"> |
|
25 | 1835 |
ls *.mp3 > list |
1836 |
for i in `cat list` |
|
1837 |
do |
|
1838 |
echo "$i" |
|
1839 |
done |
|
6 | 1840 |
</pre> |
25 | 1841 |
<p id="ch11Section_5_5b"> |
1842 |
If your filenames contain spaces, |
|
1843 |
<code class="literal"> |
|
1844 |
for |
|
1845 |
</code> |
|
1846 |
assumes each space separated word to be a single item in the list and prints it in a separate line. We could change the script slightly to overcome this problem. |
|
1847 |
</p> |
|
1848 |
<pre class="programlisting"> |
|
1849 |
for i in *.mp3 |
|
1850 |
do |
|
1851 |
echo "$i" |
|
1852 |
done |
|
1853 |
</pre> |
|
1854 |
<p id="ch11Section_5_5c"> |
|
1855 |
Now, we have each file printed on a separate line. Depending on the files that we have we could use grep to get the relevant portion of the filenames and rename the files. |
|
6 | 1856 |
</p> |
25 | 1857 |
<pre class="programlisting"> |
1858 |
for i in *.mp3 |
|
1859 |
do |
|
1860 |
j=$(echo "$i"|grep -o "[A-Za-z'&. ]*.mp3") |
|
1861 |
echo "$i -> $j" |
|
1862 |
done |
|
1863 |
</pre> |
|
1864 |
<p id="ch11Section_5_5d"> |
|
1865 |
Now we just replace the echo command with a |
|
1866 |
<code class="literal"> |
|
1867 |
mv |
|
1868 |
</code> |
|
1869 |
or a |
|
1870 |
<code class="literal"> |
|
1871 |
cp |
|
1872 |
</code> |
|
1873 |
command. |
|
6 | 1874 |
</p> |
25 | 1875 |
<pre class="programlisting"> |
1876 |
for i in *.mp3 |
|
1877 |
do |
|
1878 |
j=$(echo "$i"|grep -o "[A-Za-z'&. ]*.mp3") |
|
1879 |
cp "$i" "$j" |
|
1880 |
done |
|
1881 |
</pre> |
|
1882 |
<p id="ch11Section_5_5e"> |
|
1883 |
As an exercise, you could try sorting the files in reverse alphabetical order and then prefix numbers to each of the filenames. |
|
6 | 1884 |
</p> |
1885 |
</div> |
|
25 | 1886 |
<div class="section" title="6.4.2.while"> |
6 | 1887 |
<div class="titlepage"> |
1888 |
<div> |
|
1889 |
<div> |
|
1890 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1891 |
<a name="id2939553"> |
6 | 1892 |
</a> |
25 | 1893 |
6.4.2. |
1894 |
<code class="literal"> |
|
1895 |
while |
|
1896 |
</code> |
|
6 | 1897 |
</h4> |
1898 |
</div> |
|
1899 |
</div> |
|
1900 |
</div> |
|
25 | 1901 |
<p id="ch11Section_5_5f"> |
1902 |
The |
|
1903 |
<code class="literal"> |
|
1904 |
while |
|
1905 |
</code> |
|
1906 |
command allows us to continuously execute a block of commands until the command that is controlling the loop is executing successfully. |
|
1907 |
</p> |
|
1908 |
<p id="ch11Section_5_60"> |
|
1909 |
Let's start with the lamest example of a while loop. |
|
1910 |
</p> |
|
1911 |
<pre class="programlisting"> |
|
1912 |
while true |
|
1913 |
do |
|
1914 |
echo "True" |
|
1915 |
done |
|
1916 |
</pre> |
|
1917 |
<p id="ch11Section_5_61"> |
|
1918 |
This, as you can see, is an infinite loop that prints the |
|
1919 |
<code class="literal"> |
|
1920 |
True |
|
1921 |
</code> |
|
1922 |
. |
|
1923 |
</p> |
|
1924 |
<p id="ch11Section_5_62"> |
|
1925 |
Say we wish to write a simple program that takes user input and prints it back, until the input is |
|
1926 |
<code class="literal"> |
|
1927 |
quit |
|
1928 |
</code> |
|
1929 |
, which quits the program. |
|
1930 |
</p> |
|
1931 |
<pre class="programlisting"> |
|
1932 |
while [ "$variable" != "quit" ] |
|
1933 |
do |
|
1934 |
read variable |
|
1935 |
echo "Input - $variable" |
|
1936 |
done |
|
1937 |
exit 0 |
|
1938 |
</pre> |
|
6 | 1939 |
</div> |
25 | 1940 |
<div class="section" title="6.4.3.until"> |
6 | 1941 |
<div class="titlepage"> |
1942 |
<div> |
|
1943 |
<div> |
|
1944 |
<h4 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
1945 |
<a name="id2939603"> |
6 | 1946 |
</a> |
25 | 1947 |
6.4.3. |
1948 |
<code class="literal"> |
|
1949 |
until |
|
1950 |
</code> |
|
6 | 1951 |
</h4> |
1952 |
</div> |
|
1953 |
</div> |
|
1954 |
</div> |
|
25 | 1955 |
<p id="ch11Section_5_63"> |
1956 |
The |
|
1957 |
<code class="literal"> |
|
1958 |
until |
|
1959 |
</code> |
|
1960 |
loop is similar to the |
|
1961 |
<code class="literal"> |
|
1962 |
while |
|
1963 |
</code> |
|
1964 |
loop, except that it executes until the conditional command does not execute properly. |
|
1965 |
</p> |
|
1966 |
<p id="ch11Section_5_64"> |
|
1967 |
The infinite loop changes to the following, when |
|
1968 |
<code class="literal"> |
|
1969 |
until |
|
1970 |
</code> |
|
1971 |
is used. |
|
1972 |
</p> |
|
1973 |
<pre class="programlisting"> |
|
1974 |
until false |
|
1975 |
do |
|
1976 |
echo "True" |
|
1977 |
done |
|
1978 |
</pre> |
|
1979 |
<p id="ch11Section_5_65"> |
|
1980 |
Now lets try and use these above mentioned options provided by shell to write a utility. Until now, when we try find or locate it looks through directories and files for result. But they wont search through tar archives and zipped files. Lets create a shell script for especially looking through these files |
|
1981 |
</p> |
|
6 | 1982 |
<pre class="programlisting"> |
25 | 1983 |
#!/bin/sh |
1984 |
||
1985 |
#To check number of arguments being passed. |
|
1986 |
if [ $# -eq 0 ] ; then |
|
1987 |
echo "Correct usage: $0 tar-archive filename nOr $0 filename" |
|
1988 |
exit 1 |
|
1989 |
else |
|
1990 |
if [ $# -eq 1 ] ; then |
|
1991 |
tar_archive=`find $PWD -name "*.tar*"` |
|
1992 |
else |
|
1993 |
tar_archive=`find $PWD -name $1` |
|
1994 |
fi |
|
1995 |
fi |
|
1996 |
||
1997 |
#Search of particular file inside archives. |
|
1998 |
for archive in $tar_archive |
|
1999 |
do |
|
2000 |
echo $archive |
|
2001 |
variable=`tar -tf $archive` |
|
2002 |
for word in $variable |
|
2003 |
do |
|
2004 |
if [ $# -eq 1 ] ; then |
|
2005 |
echo "$word" | grep -q ".*$1" |
|
2006 |
else |
|
2007 |
echo "$word" | grep -q ".*$2" |
|
2008 |
fi |
|
2009 |
if [ $? -eq 0 ] ; then |
|
2010 |
echo "File present in $archive!" |
|
2011 |
fi |
|
2012 |
done |
|
2013 |
done |
|
6 | 2014 |
</pre> |
2015 |
</div> |
|
2016 |
</div> |
|
25 | 2017 |
<div class="section" title="6.5.Functions"> |
6 | 2018 |
<div class="titlepage"> |
2019 |
<div> |
|
2020 |
<div> |
|
2021 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
2022 |
<a name="id2939658"> |
6 | 2023 |
</a> |
25 | 2024 |
6.5.Functions |
6 | 2025 |
</h3> |
2026 |
</div> |
|
2027 |
</div> |
|
2028 |
</div> |
|
25 | 2029 |
<p id="ch11Section_5_66"> |
2030 |
When a group of commands are repeatedly being used within a script, it is convenient to group them as a function. This saves a lot of time and you can avoid retyping the code again and again. Also, it will help you maintain your code easily. Let's see how we can define a simple function, |
|
2031 |
<code class="literal"> |
|
2032 |
hello-world |
|
2033 |
</code> |
|
2034 |
. Functions can be defined in bash, either using the |
|
2035 |
<code class="literal"> |
|
2036 |
function |
|
2037 |
</code> |
|
2038 |
built-in followed by the function name or just the function name followed by a pair of parentheses. |
|
6 | 2039 |
</p> |
2040 |
<pre class="programlisting"> |
|
25 | 2041 |
function hello-world |
2042 |
{ |
|
2043 |
echo "Hello, World."; |
|
2044 |
} |
|
2045 |
||
2046 |
hello-world () { |
|
2047 |
echo "Hello, World."; |
|
2048 |
} |
|
2049 |
||
2050 |
$ hello-world |
|
2051 |
Hello, World. |
|
6 | 2052 |
</pre> |
25 | 2053 |
<p id="ch11Section_5_67"> |
2054 |
Passing parameters to functions is similar to passing them to scripts. |
|
6 | 2055 |
</p> |
2056 |
<pre class="programlisting"> |
|
25 | 2057 |
function hello-name |
2058 |
{ |
|
2059 |
echo "Hello, $1."; |
|
2060 |
} |
|
2061 |
||
2062 |
$ hello-name 9 |
|
2063 |
Hello, 9. |
|
6 | 2064 |
</pre> |
25 | 2065 |
<p id="ch11Section_5_68"> |
2066 |
Any variables that you define within a function, will be added to the global namespace. If you wish to define variables that are restricted to the scope of the function, define a variable using the |
|
2067 |
<code class="literal"> |
|
2068 |
local |
|
2069 |
</code> |
|
2070 |
built-in command of bash. |
|
6 | 2071 |
</p> |
25 | 2072 |
<p id="ch11Section_5_69"> |
2073 |
We shall now write a function for the word frequency generating script that we had looked at in the previous session. |
|
6 | 2074 |
</p> |
2075 |
<pre class="programlisting"> |
|
25 | 2076 |
function word_frequency { |
2077 |
if [ $# -ne 1 ] |
|
2078 |
then |
|
2079 |
echo "Usage: $0 file_name" |
|
2080 |
exit 1 |
|
2081 |
else |
|
2082 |
if [ -f "$1" ] |
|
2083 |
then |
|
2084 |
grep "[A-Za-z]*" -o "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | less |
|
2085 |
fi |
|
2086 |
fi |
|
2087 |
} |
|
6 | 2088 |
</pre> |
25 | 2089 |
<p id="ch11Section_5_6a"> |
2090 |
As an exercise, modify the function to accept the input for the number of top frequency words to be shown (if none is given, assume 10). |
|
6 | 2091 |
</p> |
2092 |
</div> |
|
25 | 2093 |
<div class="section" title="6.6.Further Reading:"> |
6 | 2094 |
<div class="titlepage"> |
2095 |
<div> |
|
2096 |
<div> |
|
2097 |
<h3 class="title"> |
|
27
cb14131583c6
Started on final changes to the build scripts so that we can start with totally automatic builds
amit@thunder
parents:
25
diff
changeset
|
2098 |
<a name="id2939729"> |
6 | 2099 |
</a> |
25 | 2100 |
6.6.Further Reading: |
6 | 2101 |
</h3> |
2102 |
</div> |
|
2103 |
</div> |
|
2104 |
</div> |
|
25 | 2105 |
<div class="itemizedlist"> |
2106 |
<ul class="itemizedlist" type="*"> |
|
2107 |
<li class="listitem" style="list-style-type: *"> |
|
2108 |
<p id="ch11Section_5_6b"> |
|
2109 |
</p> |
|
2110 |
<div class="reference"> |
|
2111 |
<div class="titlepage"> |
|
2112 |
<hr /> |
|
2113 |
</div> |
|
2114 |
http://www.freeos.com/guides/lsst/ |
|
2115 |
</div> |
|
2116 |
</li> |
|
2117 |
<li class="listitem" style="list-style-type: *"> |
|
2118 |
<p id="ch11Section_5_6c"> |
|
2119 |
</p> |
|
2120 |
<div class="reference"> |
|
2121 |
<div class="titlepage"> |
|
2122 |
<hr /> |
|
2123 |
</div> |
|
2124 |
http://bash.cyberciti.biz/guide/Main_Page |
|
6 | 2125 |
</div> |
25 | 2126 |
</li> |
2127 |
<li class="listitem" style="list-style-type: *"> |
|
2128 |
<p id="ch11Section_5_6d"> |
|
2129 |
</p> |
|
2130 |
<div class="reference"> |
|
2131 |
<div class="titlepage"> |
|
2132 |
<hr /> |
|
6 | 2133 |
</div> |
25 | 2134 |
http://tldp.org/LDP/abs/html/ |
6 | 2135 |
</div> |
25 | 2136 |
</li> |
2137 |
<li class="listitem" style="list-style-type: *"> |
|
2138 |
<p id="ch11Section_5_6e"> |
|
2139 |
</p> |
|
2140 |
<div class="reference"> |
|
2141 |
<div class="titlepage"> |
|
2142 |
<hr /> |
|
2143 |
</div> |
|
2144 |
http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html |
|
2145 |
</div> |
|
2146 |
</li> |
|
2147 |
</ul> |
|
6 | 2148 |
</div> |
2149 |
</div> |
|
2150 |
</div> |
|
2151 |
</div> |
|
2152 |
</div> |
|
2153 |
</body> |
|
1
672eaaab9204
Added some new html files that failed earlier during change from rst
amit@thunder
parents:
diff
changeset
|
2154 |
</html> |