Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.unix.questions Subject: Re: Alias command Message-ID: <754@lakart.UUCP> Date: 17 Nov 89 18:16:01 GMT Article-I.D.: lakart.754 References: <63720013@hpl-opus.HP.COM> Organization: Lakart Corporation, Newton, MA Lines: 35 steinbac@hpl-opus.HP.COM (Gunter Steinbach) sez: >> / hpl-opus:comp.unix.questions / bwildasi@silver.bacs.indiana.edu (Ben >> Wildasin) / 1:03 pm Nov 12, 1989 / > >> Another question about the alias command: > >> I would like to modify the rm command so that it first deletes the file, and >> then copies it to my nfs directory. In other words, I would like to know >> how I can create an alias that can be passed arguments. > > In ksh, you have to use a "function" instead of an alias if you want to > pass arguments to it. RTFM for details. Of course csh does not have functions. So you do things like the following: alias es 'vi +/\!:1/ `grep -l -e \!* *.[chs]`' which edits all C sources, headers and assembler sources that contain a given string: es readDirectory does a bit like a: vi -t readDirectory but as well as finding the declaration of readDirectory, it finds all USES of it. ANYWAY, the \!:n gives you the n'th argument, and \!* gives you all arguments. -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+