It is your second week in the IT section of a bank branch, and the senior engineer has left a list on the whiteboard. Every evening, before the shutters come down, someone must do the same five chores on the branch server. Check that the disk is not filling up. Count the report files that arrived today. Put a heading line at the top of each report. Make sure the new colleague's account exists. Copy the day's files to the backup machine. None of it is difficult. But it is the same twenty commands in the same order every single evening, and one evening you will be tired and skip a step.
So you do what every system administrator does: write the chores down once, in a file, and let the machine follow it. That file is a shell script. This chapter is about writing one that behaves, and about the toolbox around it: the editor you write it in on a server with no mouse, the user accounts that decide who may run it, the package tool that installs what it needs, the gauges that warn you when the disk or memory is in trouble, and the network commands that reach the other machine. It is the last chapter of the Operating Systems course, where processes, files and memory turn into commands you actually type.
By the end you will write a script with variables, arguments, decisions, loops and functions, and read its exit status, and you will write the three scripts written papers have asked for. You will edit a file in vi and get out again, read /etc/passwd and /etc/shadow, and say what useradd, passwd, su and sudo do. You will query packages, read df, du and free, and use ping, ip, ss, traceroute, nslookup, dig and arp. And you will use ssh, scp and wget with the options the exams ask for.