Summary

Shell scripts are text files containing commands, the same commands you can use at the command-line interface discussed in Chapter 7. When you run the script, the commands are executed, one by one, starting from the beginning to the end. Shell scripts are useful to automate repetitive tasks.

This chapter describes the syntax for writing shell scripts, including how to:

  • Create a shell script

  • Use variables and arrays

  • Use special characters

  • Control the flow of the script using conditional statements and loops.

  • Schedule shell scripts to run at specified times

Chapter 7 describes how to write commands. Appendix B provides a reference to the most useful commands.

Get Spring Into Linux® 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.