Description
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.
Why
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.
How
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 fun example follows, along with a screenshot of it.
luz:pd>% pev This is etsh-5.4.0 ( OpenBSD 6.5 amd64 )! /usr/local/v6bin/which /usr/local/bin/etsh /usr/local/bin/tsh /usr/local/libexec/etsh-5.4.0/tsh/fd2 /usr/local/libexec/etsh-5.4.0/tsh/glob /usr/local/libexec/etsh-5.4.0/tsh/goto /usr/local/libexec/etsh-5.4.0/tsh/if -rwxr-xr-x 1 root bin 2480 Jan 10 2018 /usr/local/v6bin/which -rwxr-xr-x 1 root bin 73808 Apr 2 03:38 /usr/local/bin/etsh -rwxr-xr-x 1 root bin 31792 Apr 2 03:38 /usr/local/bin/tsh -rwxr-xr-x 1 root bin 23352 Apr 2 03:39 /usr/local/libexec/etsh-5.4.0/tsh/fd2 -rwxr-xr-x 1 root bin 27464 Apr 2 03:38 /usr/local/libexec/etsh-5.4.0/tsh/glob -rwxr-xr-x 1 root bin 19136 Apr 2 03:39 /usr/local/libexec/etsh-5.4.0/tsh/goto -rwxr-xr-x 1 root bin 27528 Apr 2 03:39 /usr/local/libexec/etsh-5.4.0/tsh/if /usr/local/v6bin/which: a tsh script text executable /usr/local/bin/etsh: ELF 64-bit LSB shared object, x86-64, version 1 /usr/local/bin/tsh: ELF 64-bit LSB shared object, x86-64, version 1 /usr/local/libexec/etsh-5.4.0/tsh/fd2: ELF 64-bit LSB shared object, x86-64, version 1 /usr/local/libexec/etsh-5.4.0/tsh/glob: ELF 64-bit LSB shared object, x86-64, version 1 /usr/local/libexec/etsh-5.4.0/tsh/goto: ELF 64-bit LSB shared object, x86-64, version 1 /usr/local/libexec/etsh-5.4.0/tsh/if: ELF 64-bit LSB shared object, x86-64, version 1 Tuesday, 2019-04-09, 19:21:00 UTC