Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!decwrl!ogicse!schaefer From: schaefer@ogicse.ogi.edu (Barton E. Schaefer) Newsgroups: comp.unix.shell Subject: Re: How to do file | hold file Message-ID: <12014@ogicse.ogi.edu> Date: 9 Sep 90 17:53:48 GMT References: <1990Sep8.054623.3822@sj.ate.slb.com> <8147:Sep903:14:3990@kramden.acf.nyu.edu> Organization: Oregon Graduate Institute (formerly OGC), Beaverton, OR Lines: 31 In article <8147:Sep903:14:3990@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: } In article <1990Sep8.054623.3822@sj.ate.slb.com> fabrice@sj.ate.slb.com writes: } > alias apply \!\* \> /tmp/apply.\$\$ \; cp /tmp/apply.\$\$ \!\$ } } Much better is } } % alias transform '(rm \!:1;\!:2* > \!:1) < \!:1' Of course, if you WANT to put the file name at the end rather than at the beginning, you can use (sticking with the original alias name): % alias apply '( rm \!:$ ; \!:1- > \!:$ ) < \!:$' but I agree that listing the file first is clearer. The one problem I see with this is that there ought to be a way to abort if the rm doesn't happen. E.g., % transform foo.c grep -v '^/\*###' rm: override protection 444 for foo.c? Unfortunately, no matter what answer is given to this question, "rm" exits with status 0. In this particular case the grep command will fail (on an "n" response) due to lack of write permission on foo.c, but there are other cases where a problem might occur if the file isn't rm'd. Using "mv" would solve this problem, but requires a decision of where to move the file. -- Bart Schaefer schaefer@cse.ogi.edu