From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14889 invoked from network); 30 Sep 1997 16:42:23 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 30 Sep 1997 16:42:23 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id MAA14966; Tue, 30 Sep 1997 12:20:14 -0400 (EDT) Resent-Date: Tue, 30 Sep 1997 12:19:17 -0400 (EDT) To: TGAPE! Cc: schaefer@brasslantern.com, unpingco@mpl.ucsd.edu, zsh-users@math.gatech.edu Subject: Re: is text file? References: <199709292128.VAA10542@dal-tsa12-29.cyberramp.net> From: Greg Badros Date: 30 Sep 1997 09:19:45 -0700 In-Reply-To: TGAPE!'s message of "Mon, 29 Sep 1997 21:28:33 +0000 (GMT)" Message-ID: X-Mailer: Gnus v5.4.65/Emacs 19.34 Resent-Message-ID: <"HehGj2.0.Pe3.4QICq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1052 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu TGAPE! writes: > Greg Badros wrote: > > > > "Bart Schaefer" writes: > > [ NOTE: This is misattributed to Bart Scahefer, I wrote this ] > > Perhaps it would seem less hacky if there were a general > > user-programmable glob feature that would call a function on each > > filename and accept that file for the glob iff the function returns > > 0. Then the way that you determine what kind of file a filename points > > to is not part of the shell, but the nice glob modifier interface is > > permitted. > > It thusly degenerates to the case of running a find operation which execs > file on all of your files, and greps out binaries & data. Nothing really > gained, execept baggage. No then you simply add a built-in test to zsh that is true iff that argument is a text file. No extra exec-s, but still clean. > > >> An approximation might be (with extendedglob set): > >> > >> % ls **/*~*(${~${(j/|/)fignore}})(.) > >> > >> That is, all plain files that do not have extensions listed in `fignore'. > >> You could change (.) to (.^*) to omit executables, but that would also > >> omit most shell scripts. > >> > >> (Somebody tell me why the extra ${~...} is needed in that expression.) > > > > I'm fairly certain I'll never type such an incantation (how long did it > > take to dream it up? :-) ). > > Leave wizard's school now. You don't have the potential. That > incantation is trivial compared to somethings I've done. Remember, But you apparently can't even attribute text in emails properly. The point isn't whether I could figure out such a line, it's whether being able to throw together nonsensical characters correctly after 8 attempts proves anything. Yes, zsh can [almost] do it, but it's way easier to just use find or a cmd-line filter that removes arguments that aren't text files. Greg