Alias command

David Goodenough dg at lakart.UUCP
Sat Nov 18 05:16:01 AEST 1989


steinbac at hpl-opus.HP.COM (Gunter Steinbach) sez:
>> / hpl-opus:comp.unix.questions / bwildasi at 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 at lakart.UUCP - David Goodenough		+---+
						IHS	| +-+-+
	....... !harvard!xait!lakart!dg			+-+-+ |
AKA:	dg%lakart.uucp at xait.xerox.com			  +---+



More information about the Comp.unix.questions mailing list