Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!qantel!lll-lcc!lll-crg!rutgers!topaz!ll-xn!mit-amt!mit-eddie!genrad!decvax!ucbvax!hplabs!hpcea!hpfcdc!hpcnoe!jason From: jason@hpcnoe.UUCP (Jason Zions) Newsgroups: net.unix-wizards Subject: Re: comm '! sort file1' '! sort file2' Message-ID: <830003@hpcnoe.UUCP> Date: Wed, 24-Sep-86 17:27:28 EDT Article-I.D.: hpcnoe.830003 Posted: Wed Sep 24 17:27:28 1986 Date-Received: Tue, 30-Sep-86 20:31:44 EDT References: <6846@elsie.UUCP> Organization: HP Colorado Networks Division Lines: 41 > / ado@elsie.UUCP (Arthur David Olson) / 8:20 am Sep 22, 1986 / > I regularly want to run "comm" on a pair of unsorted files. > [ ... ] > All fine and dandy. But then I got to thinking. . .that what I'd *really* > like to be able to do is use a command like > > comm '! sort file1' '! sort file2' > > (where the space after the '!' should be your clue that I use csh) and have > comm do the dirty work. > > And then I got to thinking. . .that if fopen turned > fopen("!whatever", "r") > calls into > popen("whatever", "r") > calls (with other changes as necessary), then what I'd like to see happen > with the "comm" command would happen generally. You can do this more easily. Create a program, bang.c, the name of whose executable is ! . All this sucker does is a mktemp, then executes the rest of the command line as a command, redirecting stdout into the temporary file. !'s output is just the name of the temporary file. Admittedly, it's a bit dirty; the file isn't deleted, so /tmp could fill up quick. Perhaps ! could fork; the child sleeps for 5 minutes, then unlinks the temporary file. This depends on comm (or whatever) opening the temporary file soon enough. You could make the 5 minutes into 1 hour and be pretty sure. I would select some character other than ! as a command name; perhaps @. Not sacred to any shell that I know of. How's that? -- This is not an official statement of Hewlett-Packard Corp., and does not necessarily reflect the views of HP. It is provided completely without warranty of any kind. Lawyers take 3d10 damage and roll a saving throw vs. ego attack. Jason Zions Hewlett-Packard Colorado Networks Division 3404 E. Harmony Road Mail Stop 102 Ft. Collins, CO 80525 {ihnp4,seismo,hplabs,gatech}!hpfcdc!hpcnoe!jason