Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!att!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul Falstad) Newsgroups: comp.unix.shell Subject: Re: Problems with Job Control in csh Message-ID: <8075@idunno.Princeton.EDU> Date: 9 Apr 91 22:44:32 GMT References: <1991Apr9.133344.1733@mintaka.lcs.mit.edu> Sender: news@idunno.Princeton.EDU Distribution: na Organization: League For Fighting Chartered Accountancy Lines: 34 streeter@theory.lcs.mit.edu (Kenneth B Streeter) wrote: >I'm having problems with trying to do job control in a csh script. I >want to be able to commence a background job (I'm using the & >metacharacter), use it for some request-handling, and then later kill >the backgrounded job. > xterm -e "" & > # > kill %1 You can't refer to process with the "%" construct in noninteractive shells in csh; you can only do it when job control is in effect. Really, this should not require job control to be in effect; for example, this script will work fine in zsh, and also in itcsh, I believe. But if you're using an sh-derived shell (sh,ksh,bash,...) this will work fine: xterm -e "foobar" & # ... kill -9 $! I think the only way to do this in csh is to do something like this: xterm -e "foobar" & # ... kill -9 -$$ # end of script where the "kill" kills off the shell and the xterm by killing the whole process group. You're better off not to write the script in csh IMHO. -- Paul Falstad, pfalstad@phoenix.princeton.edu | 10 PRINT "PRINCETON CS" [Your blood pressure just went up.] | 20 GOTO 10 Princeton University would like to apologize to everyone for this article.