[TUHS] Systematic approach to command-line interfaces

Clem Cole clemc at ccc.com
Sun Aug 1 05:41:17 AEST 2021

On Sat, Jul 31, 2021 at 2:58 PM Michael Siegel <msi at malbolge.net> wrote:

> I mean, which shell would I use to accomplish this on Unix?

In the old days, when the first Unix shell wars started, there was a Unix
adage:  *"Bourne to Program, Type with Joy"*
FWIW: tcsh supports TOPS-20 autocomplete -- a little work with your search
engine, you can figure out how to use its many options.  That said, the GNU
bash is said to do it also, but  I can not say I have tried it personally
since the ROMS in my fingers were long ago burned to 'Type with Joy.'

Also in 50 years, it's so much that UNIX is perfect, it has lots of flaws
and quirks.  Thinking about them and considering 'better' solutions is
often wise, particularly when capabilities (like Moore's law) give you new
tools to solve them.  But a level of wisdom here is not all of those quirks
are worth repairing.  In the case of command-line parsing, getopt(3) has
proven to be 'good enough' for most things.  If it was really as bad as you
seem to think, I suspect one of the previous N attempts over the last 50
years might have taken root.

My point in my previous message was that getopt(3) was created to solve the
original UNIX problem.  It did actually take root (I'll not get into if the
Gnu long stuff was an improvement).  But there were other attempts,
including the Tops-20 scheme (which has been pointed out is quite similar
to yours) that have been around for at least 35 years in the UNIX community
and it did not catch on.  I ask you to think about if maybe your value of
that feature might be more than others have set it to be.

As an analog, when I first came to UNIX and C from other systems, ideas
like the open curly brace/close curly brace instead of BEGIN/END in C, and
there were plenty of things in Ken's original shell that I found annoying,
particularly coming from the regularity of TOPS-20 and the like.  Hey, I
used EMACS, TECO and DDT and none of them were in my new kit.   But I
forced myself to learn the new tools and new way of doing things.  Since I
was programming on UNIX in C, I made sure my code looked like everyone else
[K&R did not yet exist -- but we would later call this 'White Book C."
 Why? So someone else could read it.   I learned that style too and frankly
have a hard time with any C code that does not follow it today. But if I am
writing in a BEGIN/END style language, I adopt that style.  When in Rome
and all that.

In time, the wonderful things I could do in the UNIX world way outpaced
what I could do in the old world.   In fact, by the time either TECO or
EMACS bacame available for my use by then on a Vax, I never switched off
the earlier UNIX tools I had learned.   Like I said, I 'Type with Joy",
frankly even if I'm on a Mac, Linux or Windows -- I switch the shell to be
tcsh.  Could I learn a new shell, sure?   If I were to switch today, it
would probably be zsh, but my suggestion is to learn the tools that system
has really well.  They keep using them. Adapt to the style of the system
you are using.

Anyway, that my thoughts from an old guy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20210731/df75f832/attachment.htm>

More information about the TUHS mailing list