What this book covers
Chapter 1, The Beginning of the Scripting Journey, tells you about the importance of writing shell scripts along with a simple Hello World shell script program. It also covers the basic and essential shell script topics such as defining a variable, built-in variables, and operators. It also contains a detailed explanation of shell expansion that occurs with characters such as ~, *, ?, [], and {}.
Chapter 2, Getting Hands-on with I/O, Redirection Pipes, and Filters, talks about the standard input, output, and error streams for a command and shell script. It also has instructions on how to redirect them to other streams. One of the most powerful concepts, namely regular expressions, is also covered. It serves as instructions to commands such as grep
, sed
, uniq
, and tail
for filtering useful data from input data.
Chapter 3, Effective Script Writing, provides an insight into structuring shell scripts to organize tasks. After talking about script exit codes, it talks about basic programming
constructs such as conditionals and loops. It then goes on to discuss the organization
of code into functions and aliases. Finally, it wraps up with details on how xargs
, pushd
, and popd
works.
Chapter 4, Modularizing and Debugging, talks about making shell scripts modular by using common code that can be sourced. It also covers the details of command line arguments to scripts and how one can debug their scripts when they malfunction. This chapter also contains information on how the user can implement custom command completion.
Chapter 5, Customizing the Environment, moves on to talk about the shell environment - what it contains, its significance, and finally how to modify it. It also takes the reader through the different initialization files that bash uses at startup. Finally, we talk about how to check command history and manage running tasks.
Chapter 6, Working with Files, talks about files, which are the entities that most of any UNIX system is composed of. It covers the basic philosophy of "everything is a file" and takes the reader through basic file operations, comparing files, finding them, and creating links. This chapter then explains what special files and temporary files are, and the details involved in file permissions.
Chapter 7, Welcome to the Processes, talks about executable files that come aliveāand become processes. From listing and monitoring running processes, it goes on to talk about how to exploit process substitution. Next, it covers process scheduling priorities, signals, traps, and how processes can communicate with each other.
Chapter 8, Scheduling Tasks and Embedding Languages in Scripts, discusses scheduling tasks at appropriate times by using the system Cron. Next, it covers systems that are responsible for orchestrating startup tasks in most modern Linux systems. Finally, this chapter contains instructions on how to embed scripts from other scripting languages into a shell script.