Chapter 9. Learn Shell Scripting

This chapter covers many aspects of shell scripting. In keeping with the spirit of the book, it’s not an A-to-Z tutorial on the subject. Rather, each project tackles a particular technology pertinent to writing shell scripts. The 13 projects cover the following topics:

  • Bash functions in a script, parameter expansion, here-documents, and script debugging

  • Regular expressions, both modern (extended) and obsolete (basic)

  • Shell quoting

  • Forming conditions for use in conditional expressions

  • Subshells and command blocks

  • Traps and handles, and how to implement them in a shell script

If you are not familiar with writing shell scripts, read Projects 9 and 10 for an introduction. See Project 4 for a discussion of shell and environment ...

Get Mac OS X UNIX 101 Byte-Sized Projects 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.