Wiley
Wiley.com
Print this page Share

Shell Scripting: Expert Recipes for Linux, Bash and more

ISBN: 978-1-118-02448-5
600 pages
August 2011
Shell Scripting: Expert Recipes for Linux, Bash and more (1118024486) cover image
A compendium of shell scripting recipes that can immediately be used, adjusted, and applied

The shell is the primary way of communicating with the Unix and Linux systems, providing a direct way to program by automating simple-to-intermediate tasks. With this book, Linux expert Steve Parker shares a collection of shell scripting recipes that can be used as is or easily modified for a variety of environments or situations. The book covers shell programming, with a focus on Linux and the Bash shell; it provides credible, real-world relevance, as well as providing the flexible tools to get started immediately.

  • Shares a collection of helpful shell scripting recipes that can immediately be used for various of real-world challenges
  • Features recipes for system tools, shell features, and systems administration
  • Provides a host of plug and play recipes for to immediately apply and easily modify so the wheel doesn't have to be reinvented with each challenge faced

Come out of your shell and dive into this collection of tried and tested shell scripting recipes that you can start using right away!

See More
INTRODUCTION xxix

PART I: ABOUT THE INGREDIENTS.

CHAPTER 1: THE HISTORY OF UNIX, GNU, AND LINUX 3

CHAPTER 2: GETTING STARTED 15

CHAPTER 3: VARIABLES 33

CHAPTER 4: WILDCARD EXPANSION 67

CHAPTER 5: CONDITIONAL EXECUTION 83

CHAPTER 6: FLOW CONTROL USING LOOPS 111

CHAPTER 7: VARIABLES CONTINUED 139

CHAPTER 8: FUNCTIONS AND LIBRARIES 161

CHAPTER 9: ARRAYS 199

CHAPTER 10: PROCESSES 219

CHAPTER 11: CHOOSING AND USING SHELLS 255

PART II: RECIPES FOR USING AND EXTENDING SYSTEM TOOLS.

CHAPTER 12: FILE MANIPULATION 279

CHAPTER 13: TEXT MANIPULATION 315

CHAPTER 14: TOOLS FOR SYSTEMS ADMINISTRATION 353

PART III: RECIPES FOR SYSTEMS ADMINISTRATION.

CHAPTER 15: SHELL FEATURES 409

CHAPTER 16: SYSTEMS ADMINISTRATION 427

CHAPTER 17: PRESENTATION 459

CHAPTER 18: DATA STORAGE AND RETRIEVAL 471

CHAPTER 19: NUMBERS 483

CHAPTER 20: PROCESSES 501

CHAPTER 21: INTERNATIONALIZATION 517

PART IV: REFERENCE.

APPENDIX: FURTHER READING 529

GLOSSARY 533

INDEX 539

See More
Steve Parker is an IT consultant specializing in Solaris and GNU/Linux. He has been providing consultancy services for more than a decade. He is the author of the popular Bourne Shell Programming/Scripting Tutorial (http://steve-parker.org/sh/sh.shtml), which sees more than one million visitors a year.
See More
Download TitleSizeDownload
ReadMe 1.39 KB Click to Download
Code Download :: Chapter 2 2.17 KB Click to Download
Code Download :: Chapter 5 6.90 KB Click to Download
Code Download :: Chapter 6 7.83 KB Click to Download
Code Download :: Chapter 7 1.54 KB Click to Download
Code Download :: Chapter 8 11.72 KB Click to Download
Code Download :: Chapter 9 1.90 KB Click to Download
Code Download :: Chapter 10 2.34 KB Click to Download
Code Download :: Chapter 12 9.23 KB Click to Download
Code Download :: Chapter 13 8.29 KB Click to Download
Code Download :: Chapter 14 10.87 KB Click to Download
Code Download :: Chapter 15 3.13 KB Click to Download
Code Download :: Chapter 16 5.41 KB Click to Download
Code Download :: Chapter 17 2.00 KB Click to Download
Code Download :: Chapter 18 2.13 KB Click to Download
Code Download :: Chapter 19 2.97 KB Click to Download
Code Download :: Chapter 20 3.33 KB Click to Download
Code Download :: Chapter 21 4.40 KB Click to Download
See More

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
73 Error in Text
2nd paragraph, last sentence:

CURRENTLY SAYS:
"This is expressed as +(a-z). You can also use [:alpha:] in place of (a-z) so this example uses both.

SHOULD SAY:
"This is expressed as +([a-z]). You can also use ([:alpha:]) in place of (a-z) so this example uses both.
10/09/2013
5 95 Text correction: Error in code under "File Comparison Tests"
The second to last line of code on the page, Files file1 and file4 differ
should be deleted.
2/7/14
7 157 Text correction: Error in code under "Indirection"
In the first line of code, "mything" should read "myvar"
2/7/14
8 194 Text correction: Error under "GETOPTS"
In the first paragraph, starting with the third sentence:
"getopts displays the error message "option requires an argument -- i" but continues executing. The usage message is displayed when the script later checks if $# is equal to 2, which in this case is not true"

should read:

"getopts displays the error message "option requires an argument -- i" but continues executing with argv set to "?" which causes the usage() function to be called. usage() displays a message and exits the script. The usage message would have been displayed anyway, when the script later checks if $# is equal to 2, which in this case is not true."
4/16/14
9 215 Text correction: Error under "Deleting from an Array"
The first paagraph on the page:
"Using unset activities[7] has largely the same effect. As discussed in Chapter 7, there is a difference between setting a variable to the empty string and unsetting it entirely, but it is obvious only when the ${variable+string} or ${variable?string} forms are used."

Should read:

"Using unset activities[7] has largely the same effect. As discussed in Chapter 7, there is a difference between setting a variable to the empty string and unsetting it entirely, but it is obvious only when the ${variable+string} or ${variable?string} forms are used. In the case of an array, it also has the effect of decrementing the size of ${#activities[@]}."

The first set of output on the page should not include the line "Activity 11: parachuting"
4/15/14
See More
Buy Both and Save 25%!
+

Shell Scripting: Expert Recipes for Linux, Bash and more (US $49.99)

-and- Linux Essentials (US $39.99)

Total List Price: US $89.98
Discounted Price: US $67.48 (Save: US $22.50)

Buy Both
Cannot be combined with any other offers. Learn more.

Related Titles

Back to Top