Using Alternate DOS Shells


Introduction

As pointed out in Basic Scripting, the standard DOS shell COMMAND.COM does not support sending angle brackets to standard output, so you cannot generate HTML within the DOS Shell. It also is very limmited in its control-flow and variable handling.

I strongly recommend that you use one of the very good alternative shells and interpreters that are available. The following section describes some of the better-known alternatives. Caveat: I do not work for any of the commercial shell suppliers. This is by no means an exhaustive list:


Under Construction

Norton NDOS
This shell has many of the capabilities of the popular Unix shells, including a useful set of predefined system variables, a "here is" text output feature, escaping and quoting, and some interesting functions. It runs in very little low memory, and executes scripts much faster than COMMAND.COM. Oh, and yes, you can send angle brackets. NDOS is included with the standard Norton Utilities for DOS. Note that the documentation is not printed. It is in a large text file (~800K) on the NU distribution disks.

Microsoft QBASIC
No kidding! QBASIC comes standard with DOS, and is surprisingly complete. You can run it in a DOS VM, it has access to the CGI environment variables, and it's really easy to learn.

Microsoft Visual Basic for Windows
If you are willing to dig into the Wizard-Level Server Configuration Options, you should be able to set up a back-end engine for httpd that uses VB programs. The advantages are many. You could use VB's "Open Database Connectivity" (ODBC) support, allowing access to Microsoft Access (MDB) and SQL server relational databases. This might be an interesting alternative to GSQL. The chief disadvantage is VB's need for lots of memory and CPU time. If you have a fast 486 with lots of memory, you might give this a try.

Practical Extraction and Report Language (perl)
Also known fondly as the "Swiss-Army Chainsaw" of Unix programming. It has gotten quite popular among Unix sysadmins and other hackers. It superficially resembles awk(1), but is much hairier. This language is available for DOS, minus some Unix features such as socket I/O and fork(). If you don't already know perl, and you don't want to use NDOS or QBASIC, I suggest you have a good look at Icon. For more information on perl, see The Perl Programming Language

Tool Command Language (Tcl)
Originally developed as a command language library for inclusion in X11 user interfaces, it has evolved into a useful stand-alone command interpreter. Oddly, I have been unable to find Tcl in any form except a C library. I'll keep looking. More on this later...

The Icon Programming Language
I ran across this in a recent BYTE article, and decided to have a look. In a word, this language is great. I have fooled around with it enough to know it's a lot easier to learn than perl, and it appears perfectly suited to parsing URL-encoded stuff like POST-content from forms, and for generating HTML. To quote from the Icon manual:

Icon is a high-level programming language with extensive facilities for processing strings and structures. Icon has several novel features, including expressions that may produce sequences of results, goal-directed evaluation that automatically searches for a successful result, and string scanning that allows operations on strings to be formulated at a high conceptual level.

Icon emphasizes high-level string processing and a design philosophy that allows ease of programming and short, concise programs. Storage allocation and garbage collection are automatic in Icon, and there are few restrictions on the sizes of objects. Strings, lists, and other structures are created during program execution and their size does not need to be known when a program is written. Values are converted to expected types automatically; for example, numeral strings read in as input can be used in numerical computations without explicit conversion. Icon has an expression-based syntax with reserved words; in appearance, Icon programs resemble those of Pascal and C.

Although Icon has extensive facilities for processing strings and structures, it also has a full repertoire of computational facilities. It is suitable for a wide variety of applications. Some examples are:

    • text analysis, editing, and formatting
    • document formating
    • artificial intelligence
    • expert systems
    • rapid prototyping
    • symbolic mathematics
    • text generation
    • data laundry

Distribution kits, docs, and lots of other goodies are available from the University of Arizona Computer Science FTP Server at ftp://cs.arizona.edu/icon/


Configuration Issues

If you use an alternative DOS shell such as NDOS, no additional configuration of httpd should be needed.

If you decide to use an interpreter such as icon, QBASIC or perl, see Wizard-Level Server Configuration Options, which documents some server configuration directives that should permit you to set up an execution environment suited to your needs.


Return to the Scripting Overview
Robert B. Denny <rdenny@netcom.com>