From: "Bart Schaefer" <schaefer@brasslantern.com>
To: unpingco@mpl.ucsd.edu (Jose Unpingco), zsh-users@math.gatech.edu (zsh)
Subject: Re: is text file?
Date: Sun, 28 Sep 1997 17:06:07 -0700 [thread overview]
Message-ID: <970928170607.ZM7789@candle.brasslantern.com> (raw)
In-Reply-To: <9709282231.AA23791@cryptica.UCSD.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
next prev parent reply other threads:[~1997-09-29 0:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-09-28 22:31 Jose Unpingco
1997-09-29 0:06 ` Bart Schaefer [this message]
1997-09-29 16:25 ` Greg Badros
1997-09-29 17:44 ` Bart Schaefer
1997-09-29 21:28 ` TGAPE!
1997-09-30 3:53 ` Bart Schaefer
1997-09-30 16:19 ` Greg Badros
1997-09-30 18:56 ` Bart Schaefer
1997-09-30 20:02 ` Greg Badros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=970928170607.ZM7789@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=unpingco@mpl.ucsd.edu \
--cc=zsh-users@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).