From: kanefsky@halcyon.com (Steve Kanefsky)
Subject: Re: More Defense of CLI  (there, I changed the subject ... )
Organization: The 23:00 News and Mail Service
Date: Sat, 3 Oct 1992 23:56:07 GMT

In article <6082.2ac8918b@hayes.com> bcoleman@hayes.com (Bill Coleman) writes:
>
>The only "short-cut" built into DOS (or other CLIs) appears to be the wildcard
>matching of the "*". That appears to be the singular advantage of the CLI.
>This short-cut is unfortunately limited to a rather constrained task. I have
>yet to see any other example presented by CLI aficianados.

There are *lot* of other short-cuts built into CLIs.  I'll use tcsh 
under UNIX as an example.

First of all, tcsh has filename completion.  That means, if I type    
the first few letters of a filename and hit the TAB key, tcsh will
fill in as many of the following letters as it can.  I can then type
a few more letter and hit TAB again until I end up with a complete
filename.

For example, if I have files named "Letter to Bob" and "Letter to 
Fred" I can type "Le<tab>B<tab>" to get "Letter to Bob".  If I only
had one file that began with "Le" in the current directory, I could
just type "Le<tab>". (BTW UNIX filenames can be 128 characters long 
and can have embedded spaces, punctuation, etc.  There's also a UNIX
command which can determine the type of a file (C code, PostScript,
digitized sound, etc.) by its *content*.  Naturally the command is
extensible to handle new file formats as they come along).
     
If I forget what files I have, I can always type a couple letters and
then type ctrl-D, which will show me a list of all the files that
match.  I can also use regular expressions (not just *) to match any
set of files that can be matched by a regular expression.  Also,
there are commands like "find" which let me apply a command to  
whatever list of files the command finds.  I can easily tell the find
command to apply the print command to all the C files which      
are owned by me, readable by others, modified in the last 10 days,    
and which don't have any syntax errors, for example.

Tcsh also provides command-history editing.  The up and down cursor
keys move me up and down my command history, and the left and right  
arrow keys allow me to edit a previous command.  When I'm done I just
hit return.  I can also apply a substitution to a previous command.   
If I accidentally type "fobar" when I meant "foobar", I can just say 
"^o^oo" which means that I meant "oo" instead of "o" in the previous
command. !n repeats command number n, and !! repeats the last command.
There are dozens of other shortcuts which simply don't make sense in a
GUI (How would you tell a GUI "oops, I meant to launch SuperPaint, not
Canvas" (because they just happened to be next to each other) or "oops, I
wanted to shift-click on that 32nd icon, not deselect the other 31
icons."  You have to repeat the whole thing from scratch.)

The fact is, UNIX is so modular that you can do anything you can  
imagine.  I've often written scripts which execute a command, take
the output of that command and generate more commands from it, and  
then execute those commands.  For example, before archie came along,
I had a script which would ftp to a site, get a list of ftp sites,  
generate a script to ftp to all of those sites, get lists of the    
files at those sites, and put the lists into a tab-delimited form   
that I could import into a database. And I know relatively little   
about UNIX scripting!  The Mac GUI is great for many things, but    
there are many areas where a CLI is better.  Apple recognizes this, 
which is why MPW has a CLI and why they are developing AppleScript.
You'll note that, even though THINK C has a better compiler and linker,
most serious programs are written in MPW because the CLI offers the
power and flexibility necessary for large programming projects.

If you really think that the GUI is faster than a CLI in every case,
try this:  Go into your favorite word processor.  Type a line.  Now 
make 5 copies of the line using command-C and command-V.  Now do the
same using the copy and paste menu items.  Time each one and tell me
which is faster.  A keyboard shortcut is essentially the same as  
using a CLI, except you don't need to hit return at the end of the
command.  CLIs may have a big disadvantage in terms of the time it 
takes to learn the commands, but they often have a big advantage in
speed, especially when you were already on the keyboard anyway and
don't need to make an extra trip to the mouse and back.  If you agree
that the CLI is faster in this case, you have to agree that there are
essentially infinitely-many cases where the CLI is faster.

  
--
Steve Kanefsky

Newsgroups: comp.sys.mac.advocacy