Xref: utzoo comp.unix.questions:17643 comp.editors:1075 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.unix.questions,comp.editors Subject: Re: VI & spell Message-ID: <4525@ski.cs.vu.nl> Date: 13 Nov 89 21:57:47 GMT References: <740@uc.msc.umn.edu> Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatica, Amsterdam Lines: 53 In article <740@uc.msc.umn.edu> glex@uf.UUCP (Jeffrey Gleixner) writes: \I finally have gotten so sick of typo's that I want to run spell while in \vi, without exiting or suspending, the file. So I wrote a small script (sp). \It takes the input from vi (:1,$!sp) and redirects it to a file, I run ^^^^^^^ This command will overwrite the buffer with the output from sp. The following command will just feed the buffer to sp: :w !sp Notice the space between the `w' and the `!'. \spell on the file, pulling up a window (Sun) displaying the output from spell. \The window waits for a and then exits. Well that works just fine EXCEPT \that I can't continue with vi until I exit the window, probably waiting for \the !sp to finish. Indeed. Try something like this for sp (without the indentation!): #!/bin/sh cat > /tmp/sp.$$ trap '' 2 18 21 22 # trap SIGINT, SIGTSTP, SIGTTIN and SIGTTOU ( # do funny stuff here ) & # maybe some redirections are appropriate sp exits while its child will continue processing in the background. If you don't trap the stop signals, something `funny' happens when you stop vi (^Z) while the background job is still running, so that it would be stopped too, implicitly: (relevant BSD kernel code) case SIGTSTP: case SIGTTIN: case SIGTTOU: /* * Children of init aren't allowed to stop * on signals from the keyboard. */ if (p->p_pptr == &proc[1]) { psignal(p, SIGKILL); continue; } The stop signal is changed to a kill signal! BTW, how about the following, Mr. Bourne?! trap '' SIGINT SIGTSTP SIGTTIN SIGTTOU or trap '' INT TSTP TTIN TTOU -- "Richard Sexton is actually an AI program (or Construct, if you will) running on some AT&T (R) 3B" (Richard Brosseau) | maart@cs.vu.nl, mcsun!botter!maart