[Products and Resources for VisualAge (click here).] [BMT Micro - Registration site for the best OS/2 shareware applications available. (click here).]

TCSH v6.07.02- by Dr. Dirk Terrell

Summary: A popular Unix shell comes to OS/2, carrying with it a lot of the power associated with the industrial strength operating system.

For me, one of the greatest attractions of OS/2 is the combination of a powerful graphical user interface and a powerful command line interface. Certain tasks are more easily done with the GUI while others are better suited to a CLI. The OS/2 command shell is not too bad, especially when combined with REXX, but it lacks some features that I find essential having worked on Unix machines for years. Fortunately, there are several Unix shell ports available such as pdksh, bash, and zsh. My favorite is tcsh, a variant of csh, the C Shell.

The tcsh shell provides several features missing or cumbersome to use in the standard OS/2 shell. On a file system like HPFS where long filenames are the norm, command completion is a must. With tcsh all you have to do is type part of a filename and hit the Tab key. tcsh will then attempt to complete the filename. For example, if you have a file called My_Super_Important_File_for_the_Monday_Meeting.txt, all you have to do is type the first couple of letters and hit tab. tcsh will then type the rest for you. But what happens if you have another file called My_Super_Important_File_for_the_Friday_Meeting.txt? In that case tcsh will fill in all of the letters up to the point where the two filenames differ and beep. You then type the next letter and hit tab again to get tcsh to complete the rest of the name. Command completion is the most glaring omission in the standard OS/2 shell.

Command history is another feature that is very handy. The OS/2 shell has this feature. By issuing the command KEYS LIST you can see the list of commands that have previously been entered. You get the same list with tcsh using the history command, and the results look like this:

43  19:38   cd e:/
44  19:38   cd e-Zine/
45  19:38   cd Aug98/
46  19:38   ls
47  19:38   vi My_Super_Important_File_for_the Monday_Meeting.txt
48  19:39   vi My_Super_Important_File_for_the Monday_Meeting.txt
49  19:39   history
To execute a previous command again, you enter '!' and the number of the command in the history list (the number in the first column) as in '!46' or enter '!' and the first few characters of the command as in '!vi' (which would be the same as !48 for the history output above). The sequence !! executes the last command entered (similar to hitting F3 in the standard OS/2 shell).

Aliases are another valuable feature in shell. Sometimes you have commands that are long but used often enough that it becomes tiresome to type them frequently. Aliases solve that problem nicely. The ls command is used to do directory lists in Unix shells, but the command is known as dir to PC users. So I always alias dir to be "ls -la" with the alias command

alias dir ls -la
and then when I type dir I get a directory listing that is similar to the output of dir under the OS/2 shell.

One very cool feature of tcsh is the ability to read your mind. Well, ok, maybe not read your mind, but it does attempt to do what you mean rather than what you type, when what you type makes no sense (and that is not infrequent in my case). Suppose you have a directory os2apps/pov3/Objects that you want to go to. You type

cd os2apps/POV3/Ojbects
Normally you would expect to get some sort of "No such directory" error. tcsh looks at the command and then sees that the directory doesn't exist, but sees that f:/os2apps/POV3/Objects does exist and offers to use it instead of the nonsense that you typed:
F:/>cd os2apps/POV3/Ojbects

CORRECT>cd os2apps/POV3/Objects (y|n|e|a)?
Pressing y completes the command correctly. (To enable this feature you must enter the "set correct=all" command.)

With tcsh under OS/2 you use the tcsh.rc (FAT) or .tcshrc (HPFS) file to specify settings such as aliases, prompt, and key mappings that you want to use every time you start up the shell. This makes customizing your shell very easy.

Although it lacks some features of tcsh on a Unix machine such as job control (the ability to press Ctrl-Z and suspend a running process), the OS/2 port of tcsh is solid and definitely an alternative shell to consider. If you have never used Unix, it will probably take a while to get used to something like tcsh. If you are used to using tcsh on Unix machines, you will find that the combination of tcsh and the OS/2 ports of GNU utilities like ls, grep, etc. makes for a very comfortable CLI under OS/2. You get the command line power of Unix and the incomparable Workplace Shell for a GUI. That's about as good as it gets.

* * *

TCSH v6.07.02

by Christos Zoulas (OS/2 port by Charles Hunter
download from the OS/2 Supersite (ZIP, k)
Registration: Free

Dr. Dirk Terrell is an astronomer at the University of Florida specializing in interacting binary stars. His hobbies include cave diving, martial arts, painting and writing OS/2 software such as HTML Wizard.

Copyright © 1998 - Falcon Networking ISSN 1203-5696