Chapter 1
Introductory Shell Scripting
IN THIS CHAPTER
Trying some simple shell scripts
Discovering the basics of shell scripting
Exploring bash’s built-in commands
As you see throughout many of the preceding chapters, Linux gives you a plethora of small and specialized commands, along with the ability to connect these commands in such a way that one command’s output can be used as a second command’s input. bash
(short for Bourne Again Shell) — the default shell in most Linux systems — provides this capability in the form of I/O redirection and pipes. bash
also includes conditionals such as the if
statement that you can use to run commands only when a specific condition is true and the for
statement that can repeat the set of commands a specified number of times. You can use these features of bash
when writing programs called shell scripts: task-oriented collections of shell commands stored in a file.
This chapter shows you how to write simple shell scripts that are used to automate various tasks. Many Linux administrators create shell scripts that daily check on the status of the system disk drives, network connections, or any error messages in log files. With shell scripts you ...
Get Linux All-In-One For Dummies, 7th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.