From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1774 invoked from network); 29 Sep 1997 00:10:13 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Sep 1997 00:10:13 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id UAA18715; Sun, 28 Sep 1997 20:06:45 -0400 (EDT) Resent-Date: Sun, 28 Sep 1997 20:05:51 -0400 (EDT) From: "Bart Schaefer" Message-Id: <970928170607.ZM7789@candle.brasslantern.com> Date: Sun, 28 Sep 1997 17:06:07 -0700 In-Reply-To: <9709282231.AA23791@cryptica.UCSD.EDU> Comments: In reply to unpingco@mpl.ucsd.edu (Jose Unpingco) "is text file?" (Sep 28, 3:31pm) References: <9709282231.AA23791@cryptica.UCSD.EDU> X-Mailer: Z-Mail (4.0b.820 20aug96) To: unpingco@mpl.ucsd.edu (Jose Unpingco), zsh-users@math.gatech.edu (zsh) Subject: Re: is text file? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"1SKKk2.0.6Z4.U3lBq"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1040 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sep 28, 3:31pm, Jose Unpingco wrote: } Subject: is text file? } } I usually use PERL's -T in a function to check if a file is ASCII } or binary. Is there a way to do this using zsh. I'm sure Larry Wall will forgive me for saying that perl's -T is a hack. It reads a chunk of the file and guesses whether the whole file is ASCII based on the contents of that fragment. Zsh's globbing uses only information from readdir() and stat()/lstat(), and hopefully is going to stay that way. 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.) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com