A great walk-through creating a shader in Maya via MEL scripting from Wesley Howe. Wesley shows how to script a color-mapped shader in Maya with some simple MEL commands, no loops or heavy logic or special MEL programming techniques.
“The HyperShade tool in Maya is an example of visual programming. You start with various built-in objects and utilities, called nodes, and set them into a relationship by connecting various attributes. The simplest sort of example is linking a file node to a shader color attribute in order to texture a mesh. While the simplest way to do this does not even require you to open the HyperShade or connection editor, it can be done using them. Or it can be done via a MEL script. Making a script for the simplest operations is an exercise in time-mismanagement, unless you have a whole lot of things you want arranged in a specific manner repeatedly and without error. That is where investing time in making a script makes sense.”