csh args

Frank B. Mostek mostek at motcid.UUCP
Sat Oct 20 00:51:37 AEST 1990


pfalstad at phoenix.Princeton.EDU (Paul John Falstad) writes:

>In article <4861 at crystal1.UUCP> mostek at motcid.UUCP (Frank B. Mostek) writes:
>>How does one pass several args (more than 2), other than the !^, !*, !$
>>mechanisms, to aliases in csh?  I have read the man page, read the UNIX
>>C Shell Field Guide, and "played around" for about an hour.

>I'm not exactly sure what you want to do.   Do you know about the !:n syntax?

>% alias first echo \!:1
>% alias second echo \!:2
>% alias swap echo \!:2 \!:1
>% second a b c
>b

>If you have something specific you want, it's probably possible.

>The only way to pass arguments is through this pseudo-history-mechanism
>thing (unless you want all the arguments intact, of course).  Very
>kludgy.  It's too bad csh doesn't have shell functions.

>--
>Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
>And Dinsdale said, "You've been a naughty boy, Clement," and splits me nostrils
>open, and saws me leg off, and pulls me liver out.  And I said, "My name's not
>Clement."  And then he loses his temper.  And he nails me head to the floor.


One example is a search alias :

alias	sea	'find \!:1 -name "\!:2" -print -exec grep \!:3 {} \;'

Other things I would like to do would be to only "print" the files that grep
finds a pattern in, and pipe the grep into more.

The following alias does not work:

alias	sea	'find \!:1 -name "\!:2" -print -exec grep \!:3 {} | more \;'



More information about the Comp.unix.shell mailing list