Summary


In this chapter, you learned the fundamentals of shell programming, including how to write and execute simple shell scripts, how to include UNIX System commands in your scripts, and how to pass arguments to the shell. You also learned more advanced techniques, including flow control with if statements and for/while loops. You saw how getopts is used to parse a command line, and how expr can be used to evaluate mathematical expressions.

Shell scripting does have limitations. By itself, it is not especially good at string or text manipulation, for example. The next chapter discusses the UNIX tools awk and sed, which can be powerful additions to your scripts. They add the ability to easily process lines of text with regular expressions, and to quickly edit large sources of input.

Alternatively, once you feel comfortable with shell scripting, you may want to look at other scripting languages to get a sense of how they differ from shell. As you have seen, the shell programming language can be used to write many useful tools, and is especially good at integrating UNIX commands into scripts. However, other languages offer improvements such as cleaner syntax, advanced data structures, and better portability Chapters 22 and 23 provide introductions to Perl and Python, respectively, which are two of the most popular scripting languages in use today.




UNIX. The Complete Reference
UNIX: The Complete Reference, Second Edition (Complete Reference Series)
ISBN: 0072263369
EAN: 2147483647
Year: 2006
Pages: 316

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net