Professional Software Consulting
Shell Scripts

I use the term shell scripts to refer to both unix shell scripts as well as Windows batch programs. Batch programs are limited to the small set of commands that derived from the old DOS operating system, and while they can do certain functionality such as conditionals and variables, their sophistication is severely limited because of the nature of the operating system.

Unix shell scripting is an art almost as old as Unix itself, and pre-dates DOS by almost a decade. The unix Bourne shell, a standard part of the Unix operating system at the time, was used as a starting point for the DOS batch language. Many of the commands were removed, and the leading slash directory delimiter (/) was changed to a back slash delimiter (\) to make it easier to distinguish batch files from shell scripts.

Microsoft has advanced the cause of scripting by creating VBScript. While not capable of all the things that the Visual Basic programming language can do, the fact that a VBScript interpreter is present on every Microsoft operating system since Windows 98 means that VBScript can be used to reliably create batch programs for almost any Windows user. It also has the added benefit of executing code in an IE browser, and so has greatly surpassed the original batch file language in terms of capabilities.

While Microsoft is continuing to support VBScript from a bug-fix perspective, they are no longer adding new functionality or developing the language. Their focus is on a technology called Powershell, which integrates scripting with the .NET framework.

In the Unix world, there are many command line shells, and unix users typically have a favorite (mine is Korn shell). Because of the nature of Unix, command shells are not designed to do the same thing that Microsoft shells are. A core concept in Unix is chaining programs together: the first program runs, and its output is passed as the input to the next program, whose output is passed to the next, and so on. Because of this capability, a shell script relies on a substantial base of command line programs that have been evolving and expanding over the last four decades.

The concept behind Microsoft's Powershell seems to be modelled after Unix shell scripting, but with some important differences. The first is that Powershell can pass complex objects between programs, whereas in Unix, a single stream of raw data (typically text) is passed. Also, The capabilities of the .NET framework are being bundled to create a type of "program suite" that Powershell scripts can chain together, similar to the suite of programs available in Unix, but created in a more organized and methodical manner. Programmers will no doubt have the ability to add their own programs to their computer's repertoire, but this technology is still in its infancy.

PHP, Perl, Python and the like are scripting languages, they are not shell scripting languages. A shell is the program that runs when you login to a unix system, that gives you the ability to type commands and get results - none of these other languages qualify. A shell script can run a programming script (like PHP), and the reverse is also true, but there is no command line interpreter in these non-shell scripting languages.

When administering systems, sometimes there is no getting around the fact that you need something done without user input, or at a time when no one is logged into the system. This is where scripts really shine.

     Contact Us     

Something wrong with this page or this site? Let the webmaster know by clicking HERE
This website designed, implemented, and maintained by Corey Dulecki
© 2009-2012, Corey's Consulting LLC