|
CodingIT Library |
Unix Shell Programming is a thorough look at Classical or POSIX Shell programming. This style of shell coding is very useful in writing portable Unix shell code, that can run on a number of systems. Unix shell programming excels at showing how to write clear, clean and portable shell code. Unix Administration and Linux Administration enters a new dimension when shell coding is fully understood, shell coding readily allows for the quick automation of Unix programs and is perhaps one of the most satisfying forms of programming, as it allows very powerful digital constructs to be weaved together in short time. If there is magic in the world of computer system administration then shell scripting are the spells of power. Some more mundane folk prefer to describe scripting as the glue in a system, and there is a grain of truth to that, shell scripting does keep projects together and allows for fast alteration of a system whilst keeping the process automated. Anyone who seriously wants to do administration owes it to themselves and their clients to to study shell programming in depth, and Unix Shell Programming is a perfect book to help master the intricacies and harness the power of shell programming. Shell programming is also very applicable for development where considerable time savings can be found in creating scripts to automate development tasks. Most developers rather enjoy a bit of shell scripting as it often has a freer and more succinct expression of logic than is found in more robust application development programming languages. Unix Shell Programming is written in the tutorial style, and each chapter comes with a set of exercises on Shell Programming. Throughout a rolodex style program (called rolo) which stores contact details is used to demonstrate just how far one can go with shell programming, shell programming can be used to create applications, in fact shell programming is excellent in creating very small applications and applications where the idea is perhaps a little off the wall, but nevertheless quite useful. In fact this reviewer uses a program called idea to squirrel away ideas that pop into his head when coding or administrating, and it is quite useful to just fire off a quick command at the command line. Unix Shell Programming is perhaps a little known classic in the world of IT Books, but I personally think it is deserving of the accolade of classic IT Books. If you were to find this book early on in your administration career you would have something that would intrigue and inspire you as well as being a well thumbed book with prize of place on the desk. For those who have picked up shell programming as they have gone, Unix Shell Programming brings together all that you have learnt and will probably clear up some of the mysteries of Shell Programming, and improve the shorthand of it. Unix Shell Programming ChaptersUnix Shell Programming Chapters
Unix Shell Programming Appendices
Unix Shell Programming begins with the basics of shell usage, there is no real scripting or coding going on here, but really a look at the basic commands (programs) on a that are generally found on a Unix or Linux System. Navigating directories is explained clearly by the use of diagrams, and file name substitution (or globing) is shown to help cut down on the amount of typing one doe to help cut down on the amount of typing one does. Redirection is given a good seeing to, and this is quite an important concept in shell programming to grasp as early on as possible as most of the tricks revolve around this, may it be piping output of applications from one another or storing and retrieving information from a file, a good grounding on input and output redirection pays dividends later on down the path to full Unix Administrator status. Chapter 3 of Unix Shell Programming explains what a shell is and the different types of shell that can be used, and how the shell relates to terminals and console devices. Fairly standard fare, but worth looking into to really understand what is going, the shell acts as both a command line and an interpreted language, once that realisation hits then the possibilities of the shell can be more readily explored. Regular expressions and the various text manipulation tools entertain us in Chapter 4 of Unix Shell Programming. The shell is often used create and monitor logs, or to find information squirreled away in text based documents, and it is surprisingly easy and efficient to use the shell for many of these tasks, a well formed grep or sed can turn a task that may take days to do manually into a few seconds of digital text crunching bliss. It is here where shell programming can appear quite magical, the symbols together tend to look like some form of ancient ascii magic. Those wishing to get deeper with sed and awk would do well to purchase and read the sed and awk book these are the Unix power tools of document processing. Finally in chapter 5, we get to the beginnings of programming, the build up is definitely worth it, you have to gain an appreciation of the shell before programming in it, otherwise the paradigm becomes too skewed. Unix Shell Programming now presents to you variables and integer arithmetic, so you can use your shell as a decked out calculator for simple maths, no floaters. Chapter 6 is about quotes, personally I like these type of chapters, quotes are a useful thing to understand well, but are often overlooked primarily because it is quite hard to search for instructions on good quote usage, and perhaps because it is quite hard to express how quotes should be used. Quote are not trivial, and I am happy to see a whole chapter dedicated quotes. Quotes in shell languages, single quote ('), double quote ("), backticks or backquote (`) mean different things and it is useful to get them down to pat early than later. The use of the backslash is explained in this chapter. Chapter 7 deals with passing arguments into a script, arguments are variables supplied from outside a program, script or function. Shell programming uses a number of special looking variables to handle this, and it is useful to have them laid out in front of you. If I do have one objection to this chapter then it would be that functions are not introduced at this point, and it would be logical to introduce them here, I am off the school of encapsulate as much as possible in functions, even though the concept of localised variables is quite weak in shell scripting I prefer to see the flow of a program or script through functions. So, in many of my shell scripts you will often see a Main() {...}; Main style construct which pushes the code execution straight into a function. Chapter 8 brings us the gift of conditionals, or decision branching. I liked this chapter because I didn't realise that conditionals are actually derived from the shell's test command, I learnt to code in C before I learnt shell scripting, so I was looking out for the standard C style conditionals and it wasn't until I saw it printed here that I finally realised it was all in fact derived from test. I like to learn new things from books, and this chapter delivered that. Looping is brought to us by Chapter 9 of Unix Shell Programming. Looping is something that computers do well, looping or iteration is probably the major reason that computer systems have become quite so prolific on our planet. And computers can loop very fast, with consistent accuracy to a fairly high degree. for, while, until all get their mention, and getopts is sneakily snuck into the chapter. Breaking out of loops is also demonstrated. The rest of Unix Shell Programming delves deeper into the other mechanics surrounding shell programming, functions get a mention in chapter 15, so that makes me wonder a bit if functions are actually a part of POSIX shell programming. Well Unix Shell Programming claims it isn't but does say it is in BASH and KSH, the Open Group though has this to say: Open Group POSIX Shell Functions, there is a POSIX shell function definition command. Still UNIX Shell Programming was published in 2003, and this review is in 2009 so it is quite possible that the function definition command found its way in to the POSIX shell standards in the six years. Environment variables are also explored, along with some more commands and Shell treats. Unix Shell Programming overall is a classic Unix book, well worth the time taken to read through and play around with the various shell coding concepts the book expounds on. Diligently working through this book will enable the reader to become highly proficient in shell programming, and that means their ability to administer Unix and Linux systems is considerable. If you are into Unix developer or administrator and you want to get a good grounding in Unix Shell Programming then this is the book. | Shell |
© Poised Solutions Copyright 2008 - 2009
Web Development and Web Design by Poised Solutions IT Practice