Multiline aliases in csh ?

Larry Wall lwall at jpl-devvax.JPL.NASA.GOV
Wed Oct 24 04:58:27 AEST 1990


In article <APS.90Oct23053623 at kaarne.tut.fi> aps at tut.fi (Suntioinen Ari) writes:
: 	Is there any way to define multi line alias in csh ?
: 	What I mean is (for example) if-else or foreach loop 
: 	as a part of alias. I tried it some time and just 
: 	couldn't make it work.

No, but you can often get the same effect using a program that forces
multiple commands back into your input:

alias patchit forceme "'"'foreach file (*.pat)'"'"\; \
forceme "'"'patch <$file'"'"\; \
forceme 'end'

Won't work in a script, of course, but if you're just interested in being
a lazy typist...

: 	PS.  Right answer is not "use scripts".

Why not?  Assuming a reasonable script language, of course...   :-)

: 	PPS. Would be nice to have functions in csh.

Some would call this "throwing good money after bad".

Larry Wall
lwall at jpl-devvax.jpl.nasa.gov



More information about the Comp.unix.shell mailing list