From: heksterb@cs.utwente.nl (Ben Hekster)
Subject: Re: More Defense of CLI (there, I changed the subject ... )
Organization: University of Twente, Dept. of Computer Science
Date: Wed, 7 Oct 1992 01:05:32 GMT

In article <ewright.718384012@convex.convex.com> ewright@convex.com (Edward V. Wright) writes:
>In <1992Oct3.235607.14542@nwnexus.WA.COM> kanefsky@halcyon.com (Steve Kanefsky) writes:
>>First of all, tcsh has filename completion.  
>
>Uh, that's nice.  So does System 7.

Personally I find the kind of filename completion provided by csh
(don't know about tcsh) hard to use intuitively, because you're never
quite sure beforehand how many characters you need to type in to
completely disambiguate it from all the other files that happen to be
in that directory.  I often type too few, and csh's beeps just annoy me
to the point that I usually end up completing the file name manually.
At least with Finder type-selecting you have immediate visual feedback
on which file is selected, so I known when I can stop typing, or tab
through to the next file.

>>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).
>     
>I doubt that very much.  Both C and PostScript files usually have
>the same file type -- ASCII.

Believe it!  The `file' command actually looks at the contents of
a file and guesses the type of its contents by looking for certain
`key information'.  Try this:

	echo 'From Here to Eternity' >test; file test

happily reports that "test" is a `mail folder'.  Or take your
favorite 1MB PostScript file

	file MyHumungousPostScriptFile

		MyHumungousPostScriptFile:           PostScript document

Now, prepend a single character of choice (e.g., insert an empty line
at the top):

	file MyHumungousPostScriptFile

		MyHumungousPostScriptFile:		ascii text

Don't try to lpr this baby!

	Remember that one reason why UNIX works so well is that it
really has only one file type, namely ASCII (binary or special files
aren't especially useful in pipes).  This is also a drawback because
most programs don't do enough `type checking' on their input.  A friend
of mine lost a lot of time because he was using bit images as input
files where the program was expecting gray-scale images.  Of course,
the program didn't notice the difference and didn't complain (except
that the results were messed up-- but not enough that he noticed the
error immediately).

>>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.  
>
>Whereas, on the Mac, you'd have to go to *all the trouble* of typing
>cmd-F, a couple of returns, and the carriage return.  Yeah, that's a
>big advantage.

I find that type-selecting is much faster when you know beforehand
which folder to look in.  If you don't, filename completion isn't
going to help you much, either.

>>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.
>
>The find utility knows whether a C file contains syntax errors? 
>That's funny, the man page doesn't mention that.  However, you
>forgot one thing about find.  "The syntax is cumbersome."  That 
>isn't just my opinion, it's listed as a bug on the man page!

The great power of UNIX is its ability to combine different programs to
achieve something that wasn't explicitly built in by the programmer.
For example, `find' has an "-exec" option which allows you to invoke
the C compiler and test its exit status (and hence, find out whether a
C program has syntax errors).  I haven't found the GUI that can do
this, yet.

>>The fact is, UNIX is so modular that you can do anything you can  
>>imagine.

Precisely.

>>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!  
>
>Oh, rubbish.  Anyone who can do that is at least a quasi-expert
>on UNIX scripting.  It would take a fairly competent Hypercard
>programmer to do the same thing.


He did say "relatively little".  Don't forget that most UNIX users are
probably competent programmers and wouldn't have as much trouble coping
with shell scripting as the typical Mac user would with Hypercard
scripting.  Fundamental shell scripting skills are invaluable for
making your own customized utilities, quickly and safely, without
writing a line of C code.

	IMO, a good command-line interface can be incredibly useful to
a programmer, who is already trained to deal with command lines
anyway.  However, I can think of very few circumstances under which a
CLI would be preferable to a non-programmer, though.  I can even get my
Mom to set up and use a data base with FileMaker, but I wouldn't dream
of giving her something like dBase!

Ben
-- 
Ben `Hackster' Hekster		| "He bides his time and thinks,
heksterb@cs.utwente.nl		|  'There must be more to life than this!'"
Newsgroups: comp.sys.mac.advocacy