Shell Components   «Prev 

Unix Commands to make an Efficient Script

We need to go over the command syntax that we are going to use. The commands that we want to concentrate on in this module have to deal with while and for loops. When parsing a file in a loop, we need a method to read in the entire line of data to a variable. The most prevalent command is read and the read command is flexible in that you can extract individual strings as well as the entire line. Speaking of lines, the line command is another alternative to grab a full line of text. Some operating systems do not support the line command. For example, the line command is not available on OpenBSD and some versions of Linux and Solaris. In addition to the read and line commands, we need to look at the different ways to use the while and for loops, which is the major cause of fast or slow execution times. A loop can be used as a standalone loop in a predefined configuration; it can be used in a command pipe or with file descriptors. Each method has its own set of rules and the use of the loop is critical to get the quickest execution times.

Shell Scripting