Book description
Learn shell scripting to solve complex shell-related problems and to efficiently automate your day-to-day tasks
About This Book
- Familiarize yourself with the terminal by learning about powerful shell features
- Automate tasks by writing shell scripts for repetitive work
- Packed with easy-to-follow, hands-on examples to help you write any type of shell script with confidence
Who This Book Is For
This book is aimed at administrators and those who have a basic knowledge of shell scripting and who want to learn how to get the most out of writing shell scripts.
What You Will Learn
- Write effective shell scripts easily
- Perform search operations and manipulate large text data with a single shell command
- Modularize reusable shell scripts by creating shell libraries
- Redirect input, output, and errors of a command or script execution to other streams
- Debug code with different shell debugging techniques to make your scripts bug-free
- Manage processes, along with the environment variables needed to execute them properly
- Execute and embed other languages in your scripts
- Manage creation, deletion, and search operations in files
In Detail
Shell scripting is a quick method to prototype complex applications or problems. Shell scripts are a collection of commands to automate tasks, usually those for which the user has a repeated need, when working on Linux-based systems. Using simple commands or a combination of them in a shell can solve complex problems easily.
This book starts with the basics, including essential commands that can be executed on Linux systems to perform tasks within a few nanoseconds. You'll learn to use outputs from commands and transform them to show the data you require. Discover how to write shell scripts easily, execute script files, debug, and handle errors.
Next, you'll explore environment variables in shell programming and learn how to customize them and add a new environment. Finally, the book walks you through processes and how these interact with your shell scripts, along with how to use scripts to automate tasks and how to embed other languages and execute them.
Style and approach
This book is a pragmatic guide to writing efficient shell programs, complete with hands-on examples and tips.
Table of contents
-
Linux Shell Scripting Essentials
- Table of Contents
- Linux Shell Scripting Essentials
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. The Beginning of the Scripting Journey
-
2. Getting Hands-on with I/O, Redirection Pipes, and Filters
- Standard I/O and error streams
- Redirecting the standard I/O and error streams
- Pipe and pipelines – connecting commands
- Regular expressions
- Filtering an output using grep
- Editing output using sed
- Duplicating a stream using tee
- Sorting and finding unique text
- Character-based translation using tr
- Filtering based on lines—head and tail
- The Cut-based selection
- Summary
-
3. Effective Script Writing
- Exiting from scripts and exit codes
- Testing expressions with a test
- Using conditional statements with if and else
- Indexed arrays and associative arrays
- Looping around with for
- The select, while, and until loops
- Switch to my choice
- Passing stdout as a parameter using xargs
- Using functions and positional parameters
- Alias
- pushd and popd
- Summary
- 4. Modularizing and Debugging
- 5. Customizing the Environment
- 6. Working with Files
- 7. Welcome to the Processes
- 8. Scheduling Tasks and Embedding Languages in Scripts
- Index
Product information
- Title: Linux Shell Scripting Essentials
- Author(s):
- Release date: November 2015
- Publisher(s): Packt Publishing
- ISBN: 9781785284441
You might also like
book
Mastering Linux Shell Scripting
Master the complexities of Bash shell scripting and unlock the power of shell for your enterprise …
book
Learning Linux Shell Scripting
Unleash the power of shell scripts to solve real-world problems by breaking through the practice of …
book
Learn Linux Shell Scripting - Fundamentals of Bash 4.4
Create and maintain powerful Bash scripts for automation and administration. Key Features Get up and running …
book
Linux Shell Scripting Cookbook - Third Edition
Do amazing things with the shell About This Book Become an expert in creating powerful shell …