Cover image for Sams teach yourself shell programming in 24 hours.
Title:
Sams teach yourself shell programming in 24 hours.
Publication Information:
Indianapolis, Ind. : Sams ; Hemel Hempstead : Prentice Hall, 1999.
Physical Description:
474 pages ; 24 cm
Language:
English
Added Title:
Shell programming in 24 hours.

Teach yourself shell programming in 24 hours.
ISBN:
9780672314810
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Central Library QA76.76.O63 S343 1999 Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

Take control of your systems by harnessing the power of the shell.


Author Notes

Sriranga ^Veeraraghavan works with the Network Management group at Cisco Systems, Inc. He has several years of experience developing software in C, Java, Perl, and Shell and has been a contributing writer for several books, including UNIX Unleashed and Special Edition Using UNIX. Sriranga graduated from the University of California at Berkeley in 1997 with a degree in engineering and is currently pursuing further studies at Stanford University.


Table of Contents

Introductionp. 1
Part I Introduction to UNIX and Shell Toolsp. 7
Hour 1 Shell Basicsp. 9
What Is a Command?p. 10
Simple Commandsp. 11
Complex Commandsp. 11
Compound Commandsp. 12
Command Separatorsp. 13
What Is the Shell?p. 14
The Shell Promptp. 14
Different Types of Shellsp. 15
Summaryp. 20
Questionsp. 20
Termsp. 20
Hour 2 Script Basicsp. 23
The UNIX Systemp. 23
Logging Inp. 24
Shell Initializationp. 26
Interactive Versus Noninteractive Shellsp. 27
Initialization File Contentsp. 28
Making a Shell Script Executablep. 29
Getting Helpp. 31
Using the man Commandp. 31
Manual Sectionsp. 33
Summaryp. 34
Questionsp. 35
Termsp. 35
Hour 3 Working with Filesp. 37
Listing Filesp. 38
Hidden Filesp. 39
Option Groupingp. 40
Viewing the Content of a Filep. 41
catp. 41
Counting Words (wc)p. 42
Manipulating Filesp. 45
Copying Files (cp)p. 45
Renaming Files (mv)p. 47
Removing Files (rm)p. 48
Summaryp. 49
Questionsp. 49
Termsp. 50
Hour 4 Working With Directoriesp. 51
The Directory Treep. 52
Filenamesp. 52
Pathnamesp. 54
Switching Directoriesp. 56
Home Directoriesp. 56
Changing Directoriesp. 56
Listing Files and Directoriesp. 58
Listing Directoriesp. 59
Listing Filesp. 60
Manipulating Directoriesp. 61
Creating Directoriesp. 61
Copying Files and Directoriesp. 62
Moving Files and Directoriesp. 63
Moving Directoriesp. 65
Summaryp. 67
Questionsp. 68
Hour 5 Manipulating File Attributesp. 69
File Typesp. 69
Determining a File's Typep. 70
Regular Filesp. 70
Symbolic Linksp. 71
Device Filesp. 73
Named Pipesp. 74
Owners, Groups, and Permissionsp. 74
Viewing Permissionsp. 75
Changing File and Directory Permissionsp. 77
Changing Owners and Groupsp. 81
Summaryp. 83
Questionsp. 83
Hour 6 Processesp. 85
Starting a Processp. 86
Foreground Processesp. 86
Background Processesp. 87
Listing Running Processesp. 93
jobs Commandp. 94
ps Commandp. 94
Killing a Process (kill Command)p. 97
Parent and Child Processesp. 98
Job ID Versus Process IDp. 99
Subshellsp. 99
Process Permissionsp. 100
Overlaying the Current Process (exec Command)p. 100
Summaryp. 101
Questionsp. 101
Termsp. 101
Part II Shell Programmingp. 103
Hour 7 Variablesp. 105
Defining Variablesp. 105
Variable Namesp. 106
Accessing Valuesp. 107
Array Variablesp. 108
Accessing Array Valuesp. 110
Read-only Variablesp. 111
Unsetting Variablesp. 112
Environment Variablesp. 112
Exporting Environment Variablesp. 113
Shell Variablesp. 114
Summaryp. 115
Questionsp. 115
Termsp. 116
Hour 8 Substitutionp. 117
Filename Substitution (Globbing)p. 117
Using the * Wildcardp. 118
Using the ? Wildcardp. 120
Matching Sets of Charactersp. 121
Variable Substitutionp. 123
Substituting a Default Valuep. 123
Assigning a Default Valuep. 124
Aborting Due to Variable Errorsp. 124
Command and Arithmetic Substitutionp. 125
Command Substitutionp. 125
Arithmetic Substitutionp. 126
Summaryp. 127
Questionsp. 127
Hour 9 Quotingp. 129
Quoting with Backslashesp. 130
Using Single Quotesp. 131
Using Double Quotesp. 132
Quoting Rules and Situationsp. 134
Quoting Ignores Word Boundariesp. 134
Embedding Spaces in a Single Argumentp. 134
Quoting Newlines to Continue on the Next Linep. 135
Quoting to Access Filenames Containing Special Charactersp. 136
Quoting Regular Expression Wildcardsp. 137
Quoting the Backslash to Enable echo Escape Sequencesp. 137
Quote Wildcards for cpio and findp. 138
Summaryp. 139
Questionsp. 140
Termsp. 140
Hour 10 Flow Controlp. 143
The if Statementp. 144
An if Statement Examplep. 145
Using testp. 147
The case Statementp. 156
A case Statement Examplep. 156
Using Patternsp. 157
Summaryp. 158
Questionsp. 158
Hour 11 Loopsp. 159
The while Loopp. 160
Validating User Inputp. 162
The until Loopp. 164
The for and select Loopsp. 165
The for Loopp. 165
The select Loopp. 167
Loop controlp. 169
Infinite Loops and the break Commandp. 169
The continue Commandp. 171
Summaryp. 171
Questionsp. 172
Termsp. 173
Hour 12 Parametersp. 175
Special Variablesp. 176
Using $0p. 176
Options and Argumentsp. 178
Dealing with Arguments, An Examplep. 179
Using basenamep. 179
Common Argument Handling Problemsp. 180
Option Parsing in Shell Scriptsp. 183
Using getoptsp. 184
Conclusionp. 187
Questionsp. 188
Hour 13 Input/Outputp. 189
Outputp. 189
Output to the Terminalp. 190
Output Redirectionp. 198
Inputp. 200
Input Redirectionp. 200
Reading User Inputp. 202
Pipelinesp. 203
File Descriptorsp. 204
Associating Files with a File Descriptorp. 204
General Input/Output Redirectionp. 205
Summaryp. 209
Questionsp. 210
Termsp. 210
Hour 14 Functionsp. 211
Creating and Using Functionsp. 211
Invoking a Functionp. 212
Function Examplesp. 212
Sharing Data Between Functions, an Examplep. 216
Moving Around the File Systemp. 216
Implementing dirsp. 217
Implementing pushdp. 217
Implementing popdp. 219
Conclusionp. 221
Questionsp. 221
Hour 15 Text Filtersp. 223
The head and tail Commandsp. 224
The head Commandp. 224
The tail Commandp. 225
Using grepp. 226
Looking for Wordsp. 227
Reading From STDINp. 228
Line Numbersp. 229
Listing Filenames Onlyp. 230
Counting Wordsp. 231
The tr Commandp. 231
The sort Commandp. 233
The uniq Commandp. 233
Sorting Numbersp. 235
Using Character Classes with trp. 236
Summaryp. 238
Questionsp. 239
Hour 16 Filtering Text Using Regular Expressionsp. 241
The Basics of awk and sedp. 242
Invocation Syntaxp. 242
Basic Operationp. 242
Regular Expressionsp. 243
Using sedp. 250
Printing Linesp. 250
Deleting Linesp. 251
Performing Substitutionsp. 252
Using Multiple sed Commandsp. 255
Using sed in a Pipelinep. 255
Summaryp. 256
Questionsp. 257
Hour 17 Filtering Text with awkp. 259
What is awk?p. 259
Basic Syntaxp. 260
Field Editingp. 261
Taking Pattern-Specific Actionsp. 262
Comparison Operatorsp. 263
Using STDIN as Inputp. 266
Using awk Featuresp. 267
Variablesp. 267
Flow Controlp. 275
Summaryp. 279
Questionsp. 280
Termsp. 282
Hour 18 Miscellaneous Toolsp. 285
The eval Commandp. 286
The : Commandp. 287
The type Commandp. 288
The sleep Commandp. 288
The find Commandp. 289
find: Starting Directoryp. 290
find: name Optionp. 291
find: type Optionp. 292
find: -mtime, -atime, -ctimep. 293
find: -size Optionp. 294
find: Combining Optionsp. 294
find: Negating Optionsp. 295
find: -print Actionp. 295
find: exec Actionp. 295
xargsp. 296
The expr Commandp. 297
The bc Commandp. 299
remsh/rsh/rcmd/remote (Remote Shell)p. 300
Summaryp. 301
Questionsp. 302
Termsp. 302
Part III Advanced Topicsp. 303
Hour 19 Dealing with Signalsp. 305
How Are Signal Represented?p. 306
Getting a List of Signalsp. 306
Default Actionsp. 307
Delivering Signalsp. 307
Dealing with Signalsp. 309
The trap Commandp. 309
Cleaning Up Temporary Filesp. 310
Ignoring Signalsp. 312
Setting Up a Timerp. 312
Conclusionp. 316
Questionsp. 316
Hour 20 Debuggingp. 317
Enabling Debuggingp. 318
Using the set commandp. 319
Syntax Checkingp. 320
Why You Should Use Syntax Checkingp. 321
Using Verbose Modep. 322
Shell Tracingp. 324
Finding Syntax Bugs Using Shell Tracingp. 325
Finding Logical Bugs Using Shell Tracingp. 328
Using Debugging Hooksp. 329
Summaryp. 331
Questionsp. 332
Hour 21 Problem Solving with Functionsp. 333
Creating a Library of Functionsp. 334
Creating the Libraryp. 334
Including Functions from a Libraryp. 335
Naming Conventionsp. 335
Useful Functionsp. 336
Displaying Messagesp. 337
Asking a Questionp. 339
Checking Disk Spacep. 344
Obtaining the Process ID by Namep. 348
Getting a User's Numeric User IDp. 349
The Complete Libraryp. 350
Summaryp. 354
Questionsp. 355
Termsp. 356
Hour 22 Problem Solving with Shell Scriptsp. 357
Moving Directoriesp. 358
Using tarp. 358
mvdir.shp. 360
A Walkthrough of mvdir.shp. 362
Examplesp. 364
Maintaining an Address Bookp. 365
Showing Peoplep. 366
Adding a Personp. 368
Deleting a Personp. 372
Summaryp. 376
Questionsp. 377
Termsp. 379
Hour 23 Scripting for Portabilityp. 381
Determining UNIX Versionsp. 381
BSD Versus System Vp. 382
Using unamep. 383
Determining the UNIX Version Using a Functionp. 385
Techniques for Increasing Portabilityp. 387
Conditional Executionp. 387
Abstractionp. 389
Summaryp. 391
Questionsp. 392
Termsp. 392
Hour 24 Shell Programming FAQsp. 393
Shell and Command Questionsp. 394
Variable and Argument Questionsp. 397
File and Directory Questionsp. 399
Summaryp. 403
Part IV Appendixesp. 405
Appendix A Command Quick Referencep. 407
Reserved Words and Built-in Shell Commandsp. 408
Conditional Expressionsp. 411
File Testsp. 411
String Testsp. 411
Integer Comparisonsp. 412
Arithmetic Expressions (Korn/Bash Only)p. 412
Operators Allowed in Korn/Bash Integer Expressionsp. 412
Parameters and Variablesp. 413
User-Defined Variablesp. 413
Built-in Shell Variablesp. 414
Built-in Commands that Directly Affect Variablesp. 414
Two Types of Variablesp. 415
Shell Variablesp. 415
Parameter Substitutionp. 415
Parameter Substitution in Bourne/Korn/Bashp. 415
Parameter Substitution Only in Korn/Bashp. 416
Pattern Matchingp. 416
Pattern Wildcards Available in Bourne/Korn/Bashp. 416
Pattern Wildcards Available Only in Kornp. 417
I/Op. 417
here Documentp. 417
Miscellaneous Command Summariesp. 418
Regular Expression Wildcardsp. 419
Limited Regular Expression Wildcardsp. 420
Extended Regular Expression Wildcardsp. 420
summaryp. 420
Questionsp. 421
Appendix B Glossaryp. 423
Appendix C Quiz Answersp. 433
Chapter 1p. 433
Chapter 2p. 433
Chapter 3p. 434
Chapter 4p. 434
Chapter 5p. 434
Chapter 6p. 435
Chapter 7p. 436
Chapter 8p. 436
Chapter 9p. 436
Chapter 10p. 436
Chapter 11p. 437
Chapter 12p. 438
Chapter 13p. 439
Chapter 14p. 440
Chapter 15p. 441
Chapter 16p. 443
Chapter 17p. 443
Chapter 18p. 445
Chapter 19p. 446
Chapter 20p. 447
Chapter 21p. 448
Chapter 22p. 450
Chapter 23p. 451
Appendix Ap. 451
Indexp. 453

Google Preview