EPM startpage Homepage Contact me SiteMap


EPM 6.03 and its command shell feature - by Jörg Tiemann

Summary: Using EPM's  command shell feature you can use the standard OS/2 CLI (cmd.exe) within the EPM window. Thus without any additional software let alone costs you have a GUI for your command line activities providing you with long yearned for features as scrollback buffer, syntax highlighting and editing options. This alone should be reason enough to see if you like it. But for those of you who are still sceptic, I'll bring in some filename completion. Still not curious? Then go away! ;-)

Caution! As english.e is the only national language file being distributed all menus and dialogues of your EPM will be in English after recompilation!


 

Begin at the beginning...  

Lets start with a short analysis of what we have and what additional features we are yearning for. The standard OS/2-CLI (command line interface) is fast, it offers a stdin, a stout and a history. Moreover you can size a command line window up to 102 lines (if I'm not mistaken). Hey, you even have an insert- and a replace-mode! What? Doesn't take your breath away?

And this is what we might yearn for:

  • aliases
  • scrollback buffer
  • filename completion
  • fast directory change
  • directory hotlist
  • hotkeys
  • nifty colorful buttons
  • colors

Forget about the aliases, I have currently no means of providing you with them, but all the other features you will find in ...

 

The EPM command shell  

Though IBM's Enhanced Editor for OS/2, better known as EPM, is OS/2 e-Zine!'s double Readers' Choice Award Winner in the category text editor or programming editor, only few people seem to be aware of its power. So it was no big surprise for me to see EPM and its command shell feature not mentioned when alterative CLIs (command line interpreter) and CLI enhancements were discussed in OS/2 e-Zine! 0312. Being an almost fanatic EPM user and regular user of that very feature myself I've decided to close that gap.

In the following I presume that you are a little familiar with EPM and that there is a working EPM installation on your system that includes ETPM (the macro compiler), epm.e, epmshell.e and all the other macro files. These are files unfortunately not included in the EPM distribution that comes with Warp 4. If you need more information on how to get those files and how to get started with EPM, have a look at my EPM basics page.

 

Basic EPM Shell Features  

Now invoke an EPM shell by pressing <Ctrl-I> or <ESc> and entering shell and - voila! - 'command_shell_1' (.GIF, 50K) is added to the current edit ring. This is a temporary file EPM uses to redirect in- and output of the OS/2 CLI (cmd.exe) into. With this file you can do everything you can do with any file: you can scroll through it, edit it, save it, print it, highlight it, set bookmarks - whatever you want. Lets examine closely what options we have by entering a dir at the epm prompt. The result may look as this:

epm: D:\apps\epm\e_macros > dir

 Datenträger, Laufwerk D, hat keinen Namen.
 Datenträgernummer ist E6A7:F414
 Verzeichnis von D:\apps\epm\e_macros

18.02.97  12.47      <DIR>           0  .
18.02.97  12.47      <DIR>           0  ..
16.05.96  13.07       6184           0  ALL.E
29.02.96  13.39      10861           0  ASSIST.E
 6.02.96  11.15      35371           0  BOOKMARK.E
21.06.94  15.52       4976           0  BOX.E
...
 [bobbited for brevity]
...
12.05.97  13.28      20660           0  WINDOW.E
13.03.97   1.36       2261           0  WORDPROC.E
       128 Datei(en)    2161630 Byte belegt
                    324479488 Byte frei

Now believe it or not, the basic features are already there. With this temporary file you can do everything you can do with any file: you can scroll through it, edit it, save it, print it, highlight it, set bookmarks - whatever you want. Check it out, it has:

  •  Scrollback buffer
    Assuming that he listing of the directory you've chosen is more than one screen page long, you can now scroll to the beginning; if not, why not just duplicate some of the lines (<Ctrl-k>) until you have something to scroll?
  •  Editing options
    Or if you like that better you could resort the list. Wasn't it you I heard demanding an option to sort directory listings after the third letter of the filename a long time ago? ;-) Nothing easier than that! Just mark the column of your choice and let EPM sort (.GIF, 52K). Of course you could edit the command shell file in any other way EPM provides for editing files, too: cut, copy, paste, search, change, reflow, adjust, ...
  •  Command history
    And then I go and spoil it all by entering something stupid like just nothing. Just try it, hit the <enter> at an empty epm prompt. A dialogue box  (.GIF, 15k) pops up in which you can edit your last command, or you decide to get a list of all your commands, a list better known as command history  (.GIF, 22k).
    Another way to re-execute a former command either with or without modifications is to go up and - if necessary - edit the epm command line it's in. Then hit <enter> and this command gets copied to the current epm prompt and executed.

 

Red Alert Commands  

So far I've shown you two pictures and if you got the first one you have noticed that the EPM shell can be highlighted as every other file can be. And this is very easy to do. Just get my highlighting scheme (ZIP, 3K), place it in the EPM directory, hit <Crtl-I> again and enter togglecontrol 2 epmkwds.command_shell.  Your EPM command shell now might look like this (.GIF,55k).
I hope you like it. The idea is to highlight the prompt, internal OS/2 commands, gnu utils and other often used tools and program names. Additionally one could highlight commands or programs which might not work properly in an EPM shell in an alarming color.
Of course you can modify this highlighting scheme or create one of your own. The syntax is explained in epmkwds.c.

 

Aliases  

OS/2 doesn't offer aliases. Thus you either have to use additional programs such as 4OS/2 to get this feature, or you have to achieve whatever you wanted to achieve with aliases by other means.

Assuming that when you type dir you nearly always mean dir /oG-D /S then you are -- simply nuts. Nevertheless especially nuts people deserve a helping hand. So name this little batchfile mydir.cmd and put it somewhere in your PATH (no, not in your way! I mean into one of the directories listed in the PATH-Statement in your config.sys).

'dir /OG-D /S' %1 %2 %3 %4 %5 %6 %7 %8

A script instead of an alias.

REXX enormously enhances the possibilities such little scripts offer.

 

Fast Directory Changes
A Directory Hotlist
 

More to illustrate than to prove the previous sentence I give you a little example, a REXX script to change the current directory by looking up a shortcut for a often used directory in a list of often used directories and their shortcuts.

This script, "Jörg's Jump2Directory" is its name, has now got its own page including a download source.

 

Filename Completion  

OS/2's cmd.exe unfortunately does not offer a "filename completion" as even the blatant excuse for an CLI in Windows 2000 does.

Given this you might not be familiar with this term. Filename completion simply means that you don't have to type in all those often longish file and directory names. Instead you just type the beginning and then hit a completion key and then the shell tries to find a file or directory name starting with the letter(s) you provided. The result is inserted in your command line. If there is more than one possibility to complete your filename you can cycle through all the possible completions by repeatingly hitting the completion key.

There are other shells (command line interfaces) for OS/2 which do offer this feature (YAOS, 4OS2, bash, ...), but unfortunately this shells do not work with(in) the EPM shell. Thus I have written an EPM macro to enhance the EPM shell with filename completion.

Sounds interesting to you? OK, see ya on my Shellkram page then. There I will present you an EPM macro package of mine which is aimed at making the work in the EPM shell more comfortable.

 

Final thoughts (so far)  

An EPM shell cannot replace the usual command shell window completely. Depending on what you're about to do you'll have to choose an ordinary cmd.exe session from time to time. But in the mean time an EPM shell can be the highly customizable graphical command line interface you can do most of your daily command line work in -- enjoying features as described on this webpage. Regarding this it at least is a must-have-tried for every EPM user.


EPM startpage Top Homepage Contact me SiteMap

Copyright © 1998-2002 - Jörg Tiemann Last modified: Sun, 6 Jan 2002

gratis SMS verschicken im Uboot.com gratis HTML checken bei w3.org gratis quer denken mit Wau Holland