14

Advanced Shell Scripting

Chapter 13 has given you a foundation in the basic elements of shell scripting. At the moment, though, some of you may not be too impressed with what you can do with shell scripts. This chapter may change that! It discusses a whole range of more advanced script capabilities, which will make shell scripting a far more flexible and powerful tool in the Unix programmer's kit.

Taking a quick look back, you have learned how to choose the shell most appropriate to your needs, pass variables to your scripts, and dabble in a bit of flow control. This chapter builds on that knowledge, presenting a host of new operators, concepts, and functions, which can be used to in a wide variety of circumstances. It explores how to write and maintain secure scripts, as well as who should be allowed to execute scripts and what those scripts should be allowed to do. Topics such as restricted shells and secure wipes take the stage here.

Shells aren't limited to simple line-by-line commands. One of their more powerful features is the capability to create functions and libraries of functions. Consequently, this chapter looks at these topics and examines some of the associated topics, such as variable scope, which becomes important when dealing with more complex scripts.

Like any good programmer, you also need to think about how to debug your creations. Scripts are no different from any other language in this respect, and the chapter finishes by examining the various methods available ...

Get Beginning Unix 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.