Unix's greatest strength is that it lets you create new commands by combining old ones in unique and novel ways. However, although Unix includes hundreds of commands and there are thousands of ways to combine them, you will still encounter situations in which nothing does the job quite right. This chapter focuses on scripts that allow you to create smarter and more sophisticated programs within the constraints of shell scripts.
There's a secret that we should address up front: The shell script programming environment isn't as sophisticated as a real programming environment. Perl, Python, and even C have structures and libraries that offer extended capabilities, but shell scripts are more of a "roll your own" world. The scripts in this chapter will help you make your way in that world. They'll serve as a set of tools that will let us write better, smarter, more sophisticated scripts later in the book.
Much of the challenge of script writing arises from the subtle variations between different flavors of Unix. While the IEEE POSIX standards supposedly provide a common base of functionality across different Unix implementations , it can still be confusing to use a Solaris system after a year in a Red Hat Linux environment. The commands are different, they're in different locations, and they often have subtly different command flags. These variations can make writing shell scripts difficult too, as you may imagine.