zsh-users
 help / color / mirror / code / Atom feed
From: Greg Badros <gjb@cs.washington.edu>
To: TGAPE! <tgape@cyberramp.net>
Cc: schaefer@brasslantern.com, unpingco@mpl.ucsd.edu,
	zsh-users@math.gatech.edu
Subject: Re: is text file?
Date: 30 Sep 1997 09:19:45 -0700	[thread overview]
Message-ID: <qrrsoum7p0d.fsf@demille.cs.washington.edu> (raw)
In-Reply-To: TGAPE!'s message of "Mon, 29 Sep 1997 21:28:33 +0000 (GMT)"

TGAPE! <tgape@cyberramp.net> writes:

> Greg Badros wrote:
> >
> > "Bart Schaefer" <schaefer@brasslantern.com> 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


  parent reply	other threads:[~1997-09-30 16:42 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
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 [this message]
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=qrrsoum7p0d.fsf@demille.cs.washington.edu \
    --to=gjb@cs.washington.edu \
    --cc=schaefer@brasslantern.com \
    --cc=tgape@cyberramp.net \
    --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).