From: davidme@qdpii.comp.qdpi.oz.au (David Meiklejohn)
Subject: Re: More Defense of CLI (there, I changed the subject ... )
Organization: Qld Dept Primary Industries
Date: Thu, 8 Oct 1992 02:11:11 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:
>
>>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.  
>
>Uh, that's nice.  So does System 7.
>
>How many times will CLI advocates point out features available
>on the Mac as "advantages" of DOS or UNIX?  How many times will
>they ignore all the replies telling them that the feature is
>available, without a CLI, on the Mac?  How long will it be before
>one of them actually breaks down and *tries* a Mac? 

So far so good - don't flame systems you know nothing about.

But then you go on to say:

>>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.

I suggest you take your own advice and at least look in a Unix manual before
you want to say that those of us who use and run Unix systems are making things
up.  FYI, the command in question is "file", and here's the start of its man
entry:

|FILE(1)                  USER COMMANDS                    FILE(1)
|
|
|
|NAME
|     file - determine the type of a file by  examining  its  con-
|     tents
|
|SYNOPSIS
|     file [ -f ffile ] [ -cL ] [ -m mfile ] filename...
|
|DESCRIPTION
|     file performs a series of  tests  on  each  filename  in  an
|     attempt to determine what it contains.  If the contents of a
|     file appear to be ASCII text, file examines  the  first  512
|     bytes and tries to guess its language.
|
|     file uses the file /etc/magic to identify  files  that  have
|     some  sort  of  magic number, that is, any file containing a
|     numeric or string constant that indicates its type.


>Both C and PostScript files usually have
>the same file type -- ASCII.  

Quite right.  As the discription above says, if the file is ASCII, file has
a look at the start of the file and applies some heuristics to guess the
type.  It actually recognises Postscript code quite readily - that's one
of the easier ones.  Note that, in addition to the content-based method, it
will also use the magic number where possible.

>>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? 

No, but being flexible in the usual Unix way, it's possible to make it call
lint to check the syntax of each file found.

>That's funny, the man page doesn't mention that.

No, Unix doesn't hold your hand and point out all possibilities.  It relies
on the ability of the user to generalise and think of useful combinations
of commands.  Once you can do that, you have considerable power at your
disposal.

>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!

That's a consequence of it's inherent flexibility.  I don't find it a problem.

>>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.

I'm suprised to hear that such a thing is possible through Hypercard.  I'm
not saying it's not, though - I don't make that sort of bald statement about
things I don't know enough about.

As for needing to be a quasi-expert in Unix, I agree.  Novices can't
generally do much with scripts, and generally don't think of piping commands
into sed, etc.  The great thing about Unix, though, that attracts a lot of us,
is that, as you become more expert, you can make more and more effective use
of the system, seemingly without limit.  Most other systems seem to only let
you go so far as your experise increases.  Unix lets you grow.

By the way, I'm actually typing into a CLI (shell) window within the OpenLook
GUI running on an X terminal.  I don't really see the point of this CLI vs
GUI stuff when it's so easy to use both approaches at once.  I often browse
through files using the file manager on the Sun, complete with icons, etc.,
then type a command into an open shell window, and possibly cutting and
pasting filenames from another shell or application.  I do the same on my
Amiga at home.  It only seems to be the Mac users who don't want to use a CLI
as an integral part of their GUI environment.

-- 
David Meiklejohn (also known as davidme@qdpii.comp.qdpi.oz.au)
 - Regional support guy for PC's, Unix, and networks thereof.
 - But I'd rather be using an AMIGA!  Wouldn't you?
Find me in Mareeba, Australia (on the pointy bit in the northeast)