O'Reilly logo

From Bash to Z Shell: Conquering the Command Line by Peter Stephenson, Jerry Peek, Oliver Kiddle

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 13Scripting and Functions

A shell script may contain no more than a few commands, although the shell offers a complete programming language. Using features like loops and condition tests can allow you to do very powerful things just from the command line. Often, however, it can be useful to save a set of commands in a file for later reuse. This aspect of scripting was largely covered in Chapter 2. In this chapter we focus on more advanced uses of scripting where the script needs to make decisions based on its inputs or to the result of previous operations. A particular aim of this chapter is to introduce ways in which shell programming can be used to extend the base functionality of the shell. That theme continues into the following ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required