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 _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils