Setting Parameters.................................................................................................................................................................................................................. 229
Advanced Editing Techniques................................................................................................................................................................................................. 234
Units of Measure..................................................................................................................................................................................................................... 238
Chapter Summary.................................................................................................................................................................................................................... 241
Exercises.................................................................................................................................................................................................................................. 246
Advanced Exercises.................................................................................................................................................................................................................. 247
Chapter 7. The emacs Editor....................................................................................................................................................................................................... 250
History...................................................................................................................................................................................................................................... 251
Tutorial: Getting Started with emacs...................................................................................................................................................................................... 253
The emacs GUI........................................................................................................................................................................................................................ 260
Basic Editing Commands......................................................................................................................................................................................................... 261
Online Help.............................................................................................................................................................................................................................. 268
Advanced Editing..................................................................................................................................................................................................................... 270
Major Modes: Language-Sensitive Editing............................................................................................................................................................................. 284
Customizing emacs.................................................................................................................................................................................................................. 294
More Information.................................................................................................................................................................................................................... 299
Chapter Summary.................................................................................................................................................................................................................... 299
Exercises.................................................................................................................................................................................................................................. 307
Advanced Exercises................................................................................................................................................................................................................. 309
Part III: The Shells.............................................................................................................. 312
Chapter 8. The Bourne Again Shell............................................................................................................................................................................................. 314
Background............................................................................................................................................................................................................................... 315
Shell Basics............................................................................................................................................................................................................................... 316
Parameters and Variables........................................................................................................................................................................................................ 335
Special Characters................................................................................................................................................................................................................... 349
Processes.................................................................................................................................................................................................................................. 351
History...................................................................................................................................................................................................................................... 353
Aliases...................................................................................................................................................................................................................................... 369
Functions.................................................................................................................................................................................................................................. 372
Controlling bash: Features and Options.................................................................................................................................................................................. 375
Processing the Command Line................................................................................................................................................................................................ 379
Chapter Summary................................................................................................................................................................................................................... 388
Exercises.................................................................................................................................................................................................................................. 390
Advanced Exercises................................................................................................................................................................................................................. 392
Chapter 9. The TC Shell............................................................................................................................................................................................................... 394
Shell Scripts............................................................................................................................................................................................................................. 395
Entering and Leaving the TC Shell.......................................................................................................................................................................................... 396
Features Common to the Bourne Again and TC Shells.......................................................................................................................................................... 398
Redirecting Standard Error..................................................................................................................................................................................................... 404
Working with the Command Line........................................................................................................................................................................................... 405
Variables................................................................................................................................................................................................................................... 410
Control Structures................................................................................................................................................................................................................... 423
Builtins..................................................................................................................................................................................................................................... 432
Chapter Summary.................................................................................................................................................................................................................... 436
Exercises................................................................................................................................................................................................................................... 437
Advanced Exercises................................................................................................................................................................................................................. 439
Part IV: Programming Tools............................................................................................... 440
Chapter 10. Programming the Bourne Again Shell.................................................................................................................................................................... 442
Control Structures................................................................................................................................................................................................................... 443
File Descriptors........................................................................................................................................................................................................................ 476
Parameters and Variables........................................................................................................................................................................................................ 479
Builtin Commands................................................................................................................................................................................................................... 491
Expressions.............................................................................................................................................................................................................................. 505
Shell Programs......................................................................................................................................................................................................................... 513
Chapter Summary.................................................................................................................................................................................................................... 523
Exercises................................................................................................................................................................................................................................... 525
Advanced Exercises.................................................................................................................................................................................................................. 527
Chapter 11. The Perl Scripting Language.................................................................................................................................................................................... 530
Introduction to Perl.................................................................................................................................................................................................................. 531
Variables.................................................................................................................................................................................................................................. 538
Control Structures................................................................................................................................................................................................................... 546
Working with Files................................................................................................................................................................................................................... 555
Sort........................................................................................................................................................................................................................................... 558
Subroutines.............................................................................................................................................................................................................................. 560
Regular Expressions................................................................................................................................................................................................................ 562
CPAN Modules......................................................................................................................................................................................................................... 568
Examples.................................................................................................................................................................................................................................. 570
Chapter Summary.................................................................................................................................................................................................................... 574
Exercises................................................................................................................................................................................................................................... 574
Advanced Exercises.................................................................................................................................................................................................................. 575
Chapter 12. The AWK Pattern Processing Language.................................................................................................................................................................. 576
Syntax....................................................................................................................................................................................................................................... 577
Arguments................................................................................................................................................................................................................................ 577
A Practical Guide to Linux® Commands, Editors, and Shell Programming, Second Edition. A Practical Guide to Linux® Commands, Editors, and Shell Programming, Second Edition, ISBN: 9780137057870
Prepared for frliu@microsoft.com, Frank Liu
Copyright © 2010 Mark G. Sobell. This download file is made available for personal use only and is subject to the Terms of Service. Any other use requires prior written consent from the
copyright owner. Unauthorized use, reproduction and/or distribution are strictly prohibited and violate applicable laws. All rights reserved.
评论24