Mi-Shell, The Programmable Shell

Introduction | Quick Start | Screen Captures | Reviews


Back to Top

Introduction by the author,
Jean Michel

Why should you take a look at MSH?

It's fun and easy to try. It is a shell designed to make DOS easy for you (if you are a programmer or developer, your instinct is probably to stop reading at this point and junk the package -- a bit too early I think).

Compared to other shells, it has a rather peculiar flavor, due to its design goals. I designed it for my own use, rather than to make a commercial product for `dumb' users -- and I actually use it now all day long. Its inspiration was twofold: first, I was regretting the facilities of a good shell (like the Bourne or C-shell under UNIX). Second, I was rather favorably impressed with the design of Norton Commander, and considered it almost usable for day-to-day work, were it not for its lack of configurability and extendibility.

So it was at first an exercise in designing a completely configurable and programmable Norton Commander-like shell. I soon embedded a complete programming language inside so it is a bit more than that now. You can make it do whatever you want with a script written in the MSH language. You can even link your own new primitives written in C to it, so it is really malleable to whatever you want to make it.

It is at this point, if you are not a programmer, that you might want to stop reading. Wrong again: the purpose was to make a simple environment for me to work in. This environment defined by the default set of script files that is distributed with MSH, is quite simple and has on-line help; actually, it looks a lot like Norton Commander (but does not feel like it, feels better I think). You can change everything in this environment: the contents of menus, the default editor for files, what to do for which extension, etc... with minimal intervention on the script files and no programming skills.

A last word for you if you are a programmer: you may think that a shell like this will use too many system resources (including memory) or clutter too much your screen to be tolerable all day long. This does not take into account the possibilities of good design: although MSH with all its configuration files has a rather large memory footprint (180K), it swaps itself out of memory when executing any command so its footprint is reduced to 20K (the swapping is by default to extended memory; you can set it so if you have no XMS it swaps to a directory you specify which may be a virtual disk in EMS); you can enable or disable the swapping selectively for selected programs, to take in account any particular requirements. Also, by hitting just one touch (Ctrl+O) you can hide all MSH menus and panels and have a screen just like bare DOS, and still be under MSH and have all its facilities available.

Back to Top

Quick Start



Download the latest version (August 97)
200116 bytes. Then unzip all files in MSH.ZIP some place and type `MSH' (you can start MSH from any place as long as all the files are in the same directory as the executable MSH.EXE). You are set.

However, there are things that you may want to change in the script file which deals with system configuration, CONFIG.MSH: the color scheme (the default one is not nice on a monochrome screen), the number of floppy and hard drives you have, etc... To do that press the function key F9 which shows you the setup menu.

Once you are under MSH, just type F1 as indicated on the menu to get help. You may start by doing the tutorials which are on the help menu.

The files xxx.HLP are used by on-line help; also on-line help allows you to consult the files xxx.DOC; for this reason you should keep the .HLP and .DOC files in the same directory as MSH.EXE, although you can make a smaller installation by deleting them if you don't need on-line help.


Back to Top

Mi-Shell Screen Capture:

Default look:
MSH screen capture


Back to Top

Reviews:

It's real easy to use
by Jean-Claude Chetrit


All the clients we have in the New York Area get a copy of this product installed on their computer. It comes in handy even for the ones who don't ever use it: they use it when I help them solve technical problems over the phone. It's a lot easier to say "move the down arrow till the cursor is on top of autoexec.bat, then hit F4 to edit that file" than to dictate and spell arcane commands to someone who has never heard them before.

It also has been used by my children to find their games and play them since they have been 4 years old.

It's Not Just Another DOS Shell
by Michael Durant, NEI-PC


Since I have been looking for "The Perfect DOS Shell", I investigate every new shell program I can find. They all seemed to have one (or more) severe short commings to me. Now I have found the answer, Mi-Shell. This really is the one shell for everyone! "How can that be", you may well ask? Well, the reason is that Mi-Shell (MS) is completely configurable (programmable) by the user. You can get anything you want from Mi-Shell (sung to the tune of "Alice's Restaurant", sort of). I am going to start off by describing the system as it "comes from the box" and then discuss the "programmability" of Mi-Shell.

Mi-Shell comes from OPENetwork for only $100.00, less than the cost of any of the other comparable shell programs (such as Norton Commander, my previous favorite). The installation is simple and is done without all of the hidden, inaccessible system bashing that is so common today. Three simple DOS commands install the package: make a directory for the package, change to that directory, run the self-extracting pk-unzip on the distribution diskette. The package is installed and ready to run! If you want to start the shell on you own, type 'MSH' from the DOS prompt, or you can edit your AUTOEXEC.BAT to start it every time you boor your system. It is also advisable to add the MS directory to your path, especially if you want to start MS from some other directory, and/or use the "magic" function. "magic" is the name given by OPENetwork (ON) to the function that permits all but an 8k "kernel" of MS to be swapped out of RAM, freeing it for use by applications it "launches".

MS comes all set up to run in a default configuration that is a good starting point for many needs. Much of the default configuration reflects the Norton Commander's (NC) contribution to the field of shells. There are two independent windows. Each is controlled independently. There are two file display modes, like NC, 3 columns of file names or 1 column with size, date & time information included. Unlike NC, however, the length of each window can be adjusted from one line to 20. Movement within the windows is similar (but not identical). There is a "menu bar" on the top of the screen that can be one or two lines, and the DOS prompt is always on the 25th line (like NC).

All of the capabilities of NC are available (with some minor differences) for "tagging" files, copying the currently highlighted file's name to the command line, copying, deleting, moving, etc. But there are many more functions available with MS in this mode. In the NC, things typed that are not commands to NC are placed on the line at the DOS prompt, and "ENTER" will pass that string to COMMAND.COM normally. MS has this capability as well as many of the features of the best "command line editors" for recalling and editing past commands. This has always been one of my biggest complaints about NC.

Things typed on the command line can also be used by MS for purposes other than command execution. For instance, if I type '*.obj', it will appear on the command line. If I then hit 'ALT-P' the display for the current window will contain only the files in that directory that match that string as if I had typed "DIR *.OBJ". Another key would have "tagged" all files with the "obj" extension for use in "looped" commands (to be discussed later on). In the default configuration there are 70+ commands like these defined. NC has only a dozen or so.

So far MS looks like a nice shell program at a nice price, but so what? Well, now we come to my favorite part. If you don't like a command, you can change it, delete it or replace it. You can also add new commands that you define, and lastly, you can link in whole new functions that you write and compile (examples for C programmers are included, but the information can be extended to assembly language at least, and perhaps to other languages by OPENetwork in the future?).

Now let's begin to look at how MS works, and how we, the users, can change it for our needs. The entire system, as it comes "out of the box", is built from control files that use a simple, but powerful, set of "primitives" to create the commands that you actually execute. The system is built upon a "stack oriented" processor that is at the core of Mi Shell. It is very similar to the "Forth" programming language, and in fact, several of the basic commands like 'dup' (which duplicates the top item of "the stack") and 'swap' (which exchanges the top two items on "the stack") are identical. A more familiar example would be the RPN calculators, like the H.P. series, that use a stack. You enter numbers onto the stack, and "operation keys" like '*' (multiply) operate on one or more items on the stack. Lets take the multiply example. First you have to get the two numbers to be multiplied onto the stack. To do that you type the number (say '123.5'). That is the top of the stack. Now touch the "enter" key, which is similar to the 'dup' function, and that number is duplicated in the to two items on the stack. Now enter the next number (say '20') which will become the top stack item. At this point the stack has two items, your numbers '123.5' and '20'. If you now press the '*' key, those two numbers are removed from the stack, multiplied and the result ('2470') is pushed onto the stack. Now instead of the two original numbers, the stack has only the single result. If all of this sounds very complicated, don't panic! It is harder to describe than it is to use.

Another reason to relax is that most of the more common changes are very straight forward (mostly because OPENetwork did a great job of designing their default configuration files). Lets look at the first few changes that you will want to make (these are fully described in the manual). We will modify a file called CONFIG.MSH. This is the master configuration file.

First, lets change the editor to be called by MS when you have selected a file and press the F4 key to edit it. Mi-Shell is initially configured to use an editor that is included with the package. This is a small, fast editor that is very usable for small editing jobs (similar to the editor that NC supplies with their package. There is a line in CONFIG.MSH:

"mwe "editor! | define your editor

The text between the quotes is the name of the editor that MS supplies, mwe. Everything after the '|' is a comment. There are lots of comments in the files that OPENetwork included to help make your job easier.

Lets take a moment to look at this line and what it is doing. The line is scanned from left to right (just like you read, I hope). The first thing that MS finds is a string (everything between the quotes). That is called a token. Tokens are always pushed onto the stack. So now we have one thing on the stack, a string token ("mwe "). Now MS comes to 'editor'. It is not in quotes, so it is not a string, it is an object. Ending the line is the exclamation mark, '!'. That is one of the built in 'primitive' commands. It takes the second token on the stack (the string "mwe ") and stores it in the object named by the top of the stack (editor). Now 'editor' contains the string "mwe ", and the stack is empty.

So, to make MS use the PC-Write Lite editor (from Quicksoft), for example, change that line to read:

"lite "editor! | define your editor

It is as simple as that. Now 'editor' contains "lite ", and when you press 'F4' to edit files, MS will use PC-LITE as the editor. Next in line are the controls for the disk drives that are available for MS to use. The following lines in the file show that section of the file as shipped:

"CD" fixed_drives! | define your fixed drives
"AB"floppy_drives! | define your floppy drives

You can adjust it for extra drives that you want to be able to use, or you can lock MS out of particular drives as you desire. For example, My 'D' drive is being used by a non-DOS operating system at the moment, so I changed the fixed_drives line as follows:

"C"fixed_drives!

and so MS does not know about the D drive and does not get confused by requests to search all drives for a file, for example. Lastly, lets tell MS about some utility programs that I have available. These are lines in the same file:

false berk! false delta! false berk_cpmvrm!

Again we push two items onto the stack and store the second one in the top one. However, this time we do not have a string as the second item. The 'false' is a primitive that pushes a value that equates to false in tests (zero for number items and empty string for string items). Now when the store command (the !) executes, it stores "false" in the indicated locations. There is also a 'true' primitive for the obvious alternate boolean tests.

Again the MS manual explains how and why to change these, but it should be apparent. I have the Berkeley Utilities and delta, so the first two changes should be obvious. The third line controls the set of functions that MS uses for copy, move and delete functions. When it is set to true, MS uses versions based on the Berkeley Utilities functions 'cp' 'mv' and 'rm', otherwise it uses the DOS 'COPY' and 'DELETE' commands. I like BU, so I set this one to true also and end up with:

true berk! true delta! true berk_cpmvrm!

That is all that is required for many of the changes you are likely to need to make, especially in the beginning. As you become used to MS and its initial configuration, you will think of things to adjust, change, add or delete. Lets look at a couple of these more complicated changes.

First, I hate to wait for computers (they are supposed to be instantaneous, after all), and one of the things that PC-LITE does when starting up is to ask if a backup file should be created or not. There is a command line switch that bypasses that prompt and automatically creates the backup and goes directly to editing (another option does not create the backup before the editing starts). However, the switch has to come after the name of the file to be edited, and so I cannot make a change to the editor definition we looked at above. The change has to be made in a different section of Mi-Shell's configuration, a different file altogether, as a matter of fact.

Here is the most difficult part of changing the MS system, finding the correct file to change, There are 17 '.msh' files supplied with the system. Luckily, 4 have almost all of the code for configuring the system. In all fairness, after a about thirty minutes "poking around" in these files I had a good idea where to look for the appropriate code to change.

The four main files are CONFIG.MSH, the master config file already mentioned; KEYBIND.MSH, which describes the functions assigned to keys; MENU.MSH is for the menu and its functions; and STDDEFS.MSH, which defines most of the high level functions used by the other three files. There is also a file, BERK.MSH, that defines functions using the Berkeley Utilities; DEMO.MSH and DEMO2.MSH are tutorial/sample files that help to describe the MS environment and operation (they can be started from the MS main menu); HELP.MSH which has most of the help "stuff"; and EXT.MSH is where the 'extension' based operations are defined (i.e. if the file extension is '.wks' start '123'). The other are 6 '.MSH' files are for various display/video card combinations, only one of which will be used in any particular installation, and lastly there is MANDEL.MSH, which shows off a fractal drawing program that is distributed (along with a version of the game 'life' that is very nice) with Mi-Shell.

At any rate, I found the appropriate file (KEYBIND.MSH, which has most of the key assignment data) and the appropriate line of code:

(editor current.name&exec)F4!

Lets dissect this line. There are three "things" on the line. Everything between the parentheses is the first "thing". Just as in most languages, parentheses are used to group items. The next "thing" on the line is 'F4' and finally the '!'. The first two "things" (or objects) are "pushed" onto the stack. The exclamation point is the same 'store' command we have already seen. It saves the 'editor current.name&exec' object (we will talk about what that is in a bit) in the 'F4' object (i.e. what is "executed" every time the F4 key is pressed).

So far so good, but what did we store at F4? We stored an object with four parts: 'editor', 'current.name', '&' and 'exec'. Starting on the left, we have 'editor'. That is the object that we changed earlier to use the name of our editor. When it is encountered, the string that we assigned to the object 'editor' ("lite ") is placed on the stack. Next is 'current.name'. This is one of the MS defined 'primitives'. It "pushes" the currently highlighted file name on the current directory panel onto the stack. We next come to the '&'. This is another MS command called 'and', 'append' or 'concatenate'. It takes the top two items from the stack, "sticks them together" and then puts the result back onto the stack. For example, if we assume that current.name pushed 'sample.txt', after the '&' the top item on the stack will be 'lite sample.txt'. Finally we come to 'exec', another MS primitive. 'exec' sends the top stack item to DOS to be executed ('lite sample.txt' in this example).

Now that we know what the OPENetwork version of the command does, we can modify it for our needs. What we want is to add " /e" to the string that is sent to DOS. All we have to do is include that string and append it to the string already built using the '&' command just discussed. Our modified command definition looks like this:

(editor current.name " /e"&&exec)F4!

It could also look like this:

(editor current.name& " /e"&exec)F4!

Both definitions will create the string 'lite sample.txt /e' for 'exec'.

Using the tutorials and these simple changes as examples, it is easy to create your own definitions. You can assign definitions to all four states of the function keys, Normal, Shifted, Alt and Ctrl. Also, all four versions of the PgUp, PgDn, Home, End, arrows, Grey +, -, *. Then there are the Ctrl and Alt versions of all of the letter and number keys. That is a total of 160 keys that can have definitions. Less than half of them have been defined in the default configuration, which leaves a lot of room for your custom definitions! There are also half a dozen mouse clicks that can be defined, including support for three button rodents.

Besides the ample documentation and comments supplied with MS, there is another tool that they had the good sense to supply. That is an interactive debugger that you can turn on and off as desired. When it is enabled, each piece of a command can be stepped through one action at a time. The contents of the stack are displayed as well as the current object being process, including a pointer to the next "thing" to be processed. It is shown off well in the tutorial, and I was able to make use of it in debugging a fairly complicated command that I was trying to create. A couple of minutes with the debugger showed me the error the first time through (I had spent about half an hour before that using trial and error to solve the problem without success).

In relation to the above debugging session, I should also mention another great feature. Once you have made some changes to one of the configuration files, you can "re-load" the system to use the new commands without having to "back-out" of Mi-Shell and then restart it. This is a real time saver when you are trying to create a new command. The last point to bring up here is that I have to say that the system is VERY robust. I made some REAL stupid syntax mistakes while I was trying my hand at writing commands, and I never once was able to "lock-up" Mi-Shell (I have crashed Norton Commander more than once, and it is not programmable).

If all of the inherent programmability is not enough for you, there is also the ability to link in your own function written in C using the sample files that are supplied as a basis. There is a complete set of example files that create an example set of additional commands for MS, including a batch file that will compile, link, etc, the new system. The sample batch file assumes the Borland Turbo C compiler, but it took only a few minutes to convert for my Microsoft C compiler.

I hope that this short introduction has given you a good idea of the power inherent in this package. If, like me, you have never been satisfied with the current crop of DOS shell programs, Mi-Shell from OPENetwork may be the one that you have been waiting for too.
Back to Top



OPENetwork Delta map The Berkeley Utilities Shareware & Freeware Our People The Game of Go Links
OPENetwork | Delta | Berkeley Utilities | Shareware & Freeware | Our People | Game of Go | Map of Site | Links


Last updated on September 25, 1998
Please send any comments to Jean-Claude Chetrit