Shell Scripting

(0) Donner la première évaluation
CHF 33.00
Download est disponible immédiatement
eBook (pdf)
Informations sur les eBooks
Les eBooks conviennent également aux appareils mobiles (voir les instructions).
Les eBooks d'Ex Libris sont protégés contre la copie par ADOBE DRM: apprenez-en plus.
Pour plus d'informations, cliquez ici.

Description

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!



Auteur
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.

Texte du rabat
Tried-and-true recipes that can be immediately applied or easily adjusted to meet your needs

The shell is the primary way of communicating with Unix and Linux systems, providing a direct way to program by automating simple to intermediate tasks. In this invaluable resource, Unix, Linux, and shell scripting expert Steve Parker shares a collection of shell scripting recipes that can be used as provided or easily modified for a variety of environments and situations. The book begins with coverage of theory and principles, replete with insightful examples of each element discussed. You then move on to an in-depth discussion of shell programming, covering all Unix flavors but with a focus on Linux and the Bash shell. All the while, you explore credible, real-world recipes and the tools necessary to get started immediately.

Shell Scripting:

  • Shares a compendium of helpful shell scripting recipes that can be used to address a variety of real-world challenges

  • Includes recipes using file and text control as well as general systems administration tasks

  • Provides a host of plug-and-play recipes ready for you to immediately apply and easily modify

  • Examines variables, if/then conditionals, loops, functions, pipes, redirects, and more

wrox.com

Programmer Forums
Join our Programmer to Programmer forums to ask and answer programming questions about this book, join discussions on the hottest topics in the industry, and connect with fellow programmers from around the world.

Code Downloads
Take advantage of free code samples from this book, as well as code samples from hundreds of other books, all ready to use.

Read More
Find articles, ebooks, sample chapters, and tables of contents for hundreds of books, and more reference resources on programming topics that matter to you.



Contenu

Introduction xxix

Part I: About the Ingredients

Chapter 1: The History of Unix, Gnu, and Linux 3

Unix 3

Everything is a File and Pipelines 5

BSD 6

GNU 7

Linux 11

Summary 12

Chapter 2: Getting Started 15

Choosing an OS 15

GNU/Linux 15

The BSDs 17

Proprietary Unix 17

Microsoft Windows 17

Choosing an Editor 18

Graphical Text Editors 18

Terminal Emulation 21

Nongraphical Text Editors 22

Setting Up the Environment 24

The Shell Profile 24

Aliases 26

vim Settings 30

Summary 31

Chapter 3: Variables 33

Using Variables 33

Typing 34

Assigning Values to Variables 35

Positional Parameters 39

Return Codes 42

Unsetting Variables 45

Preset and Standard Variables 47

BASH_ENV 47

BASHOPTS 47

SHELLOPTS 48

BASH_COMMAND 50

BASH_SOURCE, FUNCNAME, LINENO, and BASH_LINENO 51

SHELL 55

HOSTNAME and HOSTTYPE 55

Working Directory 55

PIPESTATUS 55

TIMEFORMAT 56

PPID 57

RANDOM 58

REPLY 58

SECONDS 58

BASH_XTRACEFD 59

GLOBIGNORE 60

HOME 62

IFS 62

PATH 63

TMOUT 64

TMPDIR 65

User Identification Variables 65

Summary 66

Chapter 4: Wildcard Expansion 67

Filename Expansion (Globbing) 67

Bash Globbing Features 70

Shell Options 71

Regular Expressions and Quoting 75

Overview of Regular Expressions 76

Quoting 77

Summary 81

Chapter 5: Conditional Execution 83

If/Then 83

Else 85

elif 85

Test ([) 87

Flags for Test 88

File Comparison Tests 95

String Comparison Tests 96

Regular Expression Tests 98

Numerical Tests 101

Combining Tests 103

Case 105

Summary 109

Chapter 6: Flow Control Using Loops 111

For Loops 111

When to Use for Loops 112

Imaginative Ways of Feeding for with Data 112

C-Style for Loops 118

while Loops 119

When to Use while Loops 119

Ways to Use while Loops 119

Nested Loops 125

Breaking and Continuing Loop Execution 126

while with Case 130

until Loops 131

select Loops 133

Summary 137

Chapter 7: Variables Continued 139

Using Variables 139

Variable Types 141

Length of Variables 142

Special String Operators 144

Stripping Variable Strings by Length 144

Stripping from the End of the String 146

Stripping Strings with Patterns 147

Searching Strings 151

Using Search and Replace 151

Replacing Patterns 153

Deleting Patterns 153

Changing Case 153

Providing Default Values 153

Indirection 157

Sourcing Variables 158

Summary 159

Chapter 8: Functions and Libraries 161

Functions 161

Defining Functions 162

Function Output 162

Writing to a File 164

Redirecting the Output of an Entire Function 167

Functions with Trap 171

Recursive Functions 173

Variable Scope 177

Libraries 181

Creating and Accessing Libraries 183

Library Structures 183

Network Configuration Libr...

Afficher plus

Détails sur le produit

Titre
Shell Scripting
Sous-titre
Expert Recipes for Linux, Bash and more
Auteur
EAN
9781118166338
ISBN
978-1-118-16633-8
Format
eBook (pdf)
Producteur
Wrox
Editeur
Wrox
Genre
Systèmes d'exploitation, interfaces utilisateur
Parution
15.08.2011
Protection contre la copie numérique
Adobe DRM
Taille de fichier
13.7 MB
Nombre de pages
576
Année
2011
Afficher plus
Les clients ayant acheté cet article ont également acheté :