This is an introduction/overview of why and how to use etsh and tsh. The objective is to provide instruction about effectively using these shells interactively and for scripting via examples and tips.

For useful, living, full-blown examples, please refer to Examples (for RC Files), Tests (for Regression Tests), and V6Scripts (for Command Files).

These resources, along with the manuals, provide an excellent foundation for the major concepts in my estimation. However, if you find that your questions are still unanswered, please do feel free to contact me. I would certainly be glad to help.


You may wonder why a person would want to use a port of an ancient UNIX shell like etsh or tsh instead of a modern UNIX shell. Consider this question. Is it possible to use the shell to do more work with less compiled C source code? Yes, it is quite possible. This challenge and the associated benefits of seeing possibilities instead of limitations drives me to use these shells.

Essentially, the idea of "possibilities" in this case boils down to the simple fact that you can do quite a lot with even the most basic shell on a UNIX system. It is important to remember that a UNIX system is a set of tools (aka utilities). These shells, all shells in fact, are tools which are part of the UNIX toolbox. Knowing how to use these tools together is the key to getting your work done.

The usefulness of these shells in a given context is a function of the utilities the user chooses to complement the basic shell functionality. For example, the system utilities which are often useful in such a context include awk(1), expr(1), grep(1), sed(1), and a whole slew of others. In fact, proper use of the proper utilities in a pipeline can eliminate a host of imagined limitations which may be placed on these shells. Also, remember that temporary files are helpful when needed.

All of this can prove to be challenging, educational, and fun. It can also facilitate "remembering our history" which is something that is always important in my estimation. Consider trying etsh and tsh for yourself to see that doing more with less is both possible and beneficial.


So, how does a person go about using etsh and tsh? Well, if you know how to use sh(1), csh(1), or one of their derivatives, you pretty much already know how to use etsh(1) and tsh(1). At this point, it's primarily a matter of thinking "outside the shell" itself and focusing on the pipeline concept as the prime mover of UNIX shell power.

% : A happy little example follows.
% echo -n Executing $v 'on ' ; uname -srm ; which which osh sh6 ; \
  which which osh sh6 | \
        ( tr '\n' ' ' ; echo ) | \
                sed 's/.*/ls -fl & ; file &/' | osh | cut -c -76
Executing osh-20160108 on NetBSD 7.0 amd64
-r-xr-xr-x  1 root  wheel   2488 Jan 16 20:05 /usr/local/v6bin/which
-r-xr-xr-x  1 root  wheel  44584 Jan 13 17:49 /usr/pkg/bin/osh
-r-xr-xr-x  1 root  wheel  20656 Jan 10 12:15 /usr/local/bin/sh6
/usr/local/v6bin/which: a /usr/bin/env sh6 script, ASCII text executable
/usr/pkg/bin/osh:       ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
/usr/local/bin/sh6:     ELF 64-bit LSB executable, x86-64, version 1 (SYSV),