Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!euclid.jpl.nasa.gov!pjs From: pjs@euclid.jpl.nasa.gov (Peter Scott) Newsgroups: comp.unix.questions Subject: How does a shell know if it's in the foreground or the background? Message-ID: <1991Apr24.232959.6247@elroy.jpl.nasa.gov> Date: 24 Apr 91 23:29:59 GMT Sender: news@elroy.jpl.nasa.gov (Usenet) Reply-To: pjs@euclid.jpl.nasa.gov Followup-To: comp.unix.questions Organization: Jet Propulsion Laboratory, NASA/Caltech Lines: 11 Nntp-Posting-Host: euclid.jpl.nasa.gov One of our users asked this and I'm stumped. You have a script and you want to know whether the user is sitting there at the terminal waiting with baited breath for it to complete or whether the hyperactive creature typed an "&" after it and went on with other work. I thought I could just test $prompt, but that only tells me whether I've source'd a script or not. How can a csh script know whether it's on the job list? -- This is news. This is your | Peter Scott, NASA/JPL/Caltech brain on news. Any questions? | (pjs@euclid.jpl.nasa.gov)