Overview
Shell scripting is incredibly powerful. You can automate many processes and combine the wealth of Unix utility programs to process data without having to write custom programs. This chapter should have given you all of the tools and background details you need to explore this new world.
For now though, we only need a few commands. So don’t worry if you are not yet confident in what you can do in the shell. The main things you need to be able to do are:
- Navigate to a folder in the Terminal (
cd
). You will need to do this to build and run your programs. - List files (
ls
) and check their contents (cat
). This is useful to make sure that you are in the right place in the shell, and to help you with moving around.
The following knowledge will help as you start to build programs:
- Understanding files and the file system will be important for navigating around. You can drag files and folders in from your file explorer if you get stuck.
- Streams and standard input and standard output. Many of the small programs you create will use these to interact with the user in the terminal.
- Signals to kill a broken program (ctrl-c). When you are writing and testing programs they can go wrong, and you will need tools to be able to stop them.
The rest of the tools presented in this chapter are things you can come back to and work on over time.
You are already starting to program the computer. You can give it shell commands to do things directly, and save shell commands into scripts that can help automate tasks.
In the next chapter we will see how to build our own programs. To do this you will need to navigate the file system through the terminal, and run a few additional programs. Confidence with the basics presented in this chapter will mean that you are set to take the next step.