bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add new program: magic


From: Bob Proulx
Subject: Re: [PATCH] Add new program: magic
Date: Wed, 9 Apr 2008 19:48:51 -0600
User-agent: Mutt/1.5.13 (2006-08-11)

Bo Borgerson wrote:
> As I thought more about this functionality I realized that it may be
> more broadly useful.  Any utility that can operate on multiple input
> files could benefit.  I wondered if it would be possible in a
> non-invasive way to provide this service to other tools.  This is what
> I came up with.
> 
> Instead of:
> $ sort --magic-open a.gz b.bz2 c.txt
> 
> I run:
> $ magic sort a.gz b.bz2 c.txt

I like this sort of general purpose utility that can work with a broad
set of things much better than hacks to every utility.  It is
definitely a better direction.

But I don't like the name.  The name is too generic and doesn't give a
clue as to what it actually does.  This is probably better to name
something like daylight-commander or some such (with apologies to
Nortan and midnight-commander).

Additionally I have to note that bash (and probably other shells)
already supply this capability in a generic way.

  sort <(zcat a) <(zcat b) c

> Then I realized that this automatic fifo management might be more
> useful still.  In addition to checking the `magic' bytes at the
> beginning of regular files for known decompression programs, I thought
> it might be useful to allow an arbitrary sub-command to be used as an
> input.

This is getting to be too heuristic driven (too error prone) for my
tastes.

> For example, to compare the output of two versions of a program:
> $ magic diff "ls -l" "src/ls -l"

  diff <(ls -l) <(./src/ls -l)

> Or to compare files on two remote machines:
> $ magic diff "ssh host1 cat /etc/passwd" "ssh host2 cat /etc/passwd"

  diff <(ssh -n host1 cat /etc/passwd) <(ssh -n host2 cat /etc/passwd)

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]