Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.unix.shell Subject: Re: Multiline aliases in csh ? Message-ID: <4158:Oct2321:22:3290@kramden.acf.nyu.edu> Date: 23 Oct 90 21:22:32 GMT References: <10084@jpl-devvax.JPL.NASA.GOV> Organization: IR Lines: 56 In article <10084@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: > 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' I assume that ``forceme'' uses TIOCSTI to simulate terminal input. For readers without it, enclosed is tiocsti, which does the same job. > Won't work in a script, of course, but if you're just interested in being > a lazy typist... Right. Btw, why don't you use \' rather than "'"? Might not work in awk, of course, but if you're just interested in being a lazy typist... Actually, it'd be a lot clearer to just double-quote your entire alias. ---Dan /* Public domain. */ #include main(argc,argv) int argc; char *argv[]; { int j; char *s; if (ioctl(3,TIOCGPGRP,(char *) &j) == -1) (void) dup2(0,3); for (j = 1;j < argc;j++) { for (s = argv[j];*s;s++) (void) ioctl(3,TIOCSTI,s); if (j < argc - 1) (void) ioctl(3,TIOCSTI," "); } } TH tiocsti 1 SH NAME tiocsti \- simulate terminal input SH SYNOPSIS B tiocsti [ I arg ] ... SH DESCRIPTION I tiocsti ``types'' each of its arguments on the current terminal, separated by spaces, as if you had typed them. SH "SEE ALSO" tty(4)