N S

Novick Software Management • Design • Programming • Training • Consulting

   

 

 

msh monad the microsoft shell

 Monad

 By: Andy Oakley

 Publisher: O'Reilly, December 2005
 

Review by Andrew Novick

Summary:  A quick intro to the public Beta version of the Microsoft Shell (MSH).

Once upon a time I used the command line all the time.  DEC’s VMS command line was pretty good.  UNIX has several command shells and I coded many c shell and korn shell scripts including a few that were used as part of a production application for 10 years. 

Programming in Windows for the last 15 or so years, I don’t get many chances except for the occasional .BAT or .CMD file.   And I only use these tools when really really necessary.  If I have to write a program, I fire up Visual Studio and write a command line program in VB.Net or C#.

 That’s starting to change as I learn the Microsoft Shell (MSH) also know as Monad.  To get going I picked up a copy of Monad by Andy Oakley.  For an introduction to the beta, it’s a fine book.  Short and to the point with easy to understand examples.

 The key to monad is the pipeline.  In cmd.exe and various UNIX shells the pipeline takes the text output of one command and feeds it to the next command.  In monad, the pipeline consists of .Net objects until the pipeline reaches the console where the formatter turns it into text.  Because objects travel down the pipe, you can use all the properties and methods that are part of the object.  Way cool.

So what you get in the end is a new way to program with .Net objects.  UNIX shells were always programs in a way but they are always pretty brittle.  They break easily because the exact layout of the textual output of a command is subject to change for so many reasons.  For example, did you write the code in a month with one digit?  Then what happens in October when dates have two digits?  Does the text move one character over?  Does this mess up your script? Working with objects takes the guesswork out of the textual pipeline.

 What the book doesn’t cover is the topic of extensibility.  There are several ways to extend MSH including writing commandlets and data providers.  Someone else will have to write that one.

 If you want to learn MSH now, this is a fine book.  It’s short because it doesn’t repeat much of the documentation.  I’m sure there will be more complete texts to come down the pipe when the product is released but for now this book is the only game in town.


RSS as HTML

Personal Blog

 
New Tips:

Loading SQL Profiler trace (.trc) files with fn_trace_gettrace

Upcoming
Presentations:

Big Data:
Working with Terabytes
in SQL Server

July 9 '08


Full Schedule