How does a shell know if it's in the foreground or the background?

Peter Scott pjs at euclid.jpl.nasa.gov
Thu Apr 25 09:29:59 AEST 1991


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 at euclid.jpl.nasa.gov)



More information about the Comp.unix.questions mailing list