Newsgroups: comp.unix.questions
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!caen!hellgate.utah.edu!csn!boulder!tramp.Colorado.EDU!lewis
From: lewis@tramp.Colorado.EDU (LEWIS WILLIAM M JR)
Subject: Re: How does a shell know if it's in the foreground or the background?
Message-ID: <1991Apr25.194119.6911@colorado.edu>
Sender: news@colorado.edu (The Daily Planet)
Nntp-Posting-Host: tramp.colorado.edu
Organization: University of Colorado, Boulder
References: <1991Apr24.232959.6247@elroy.jpl.nasa.gov>
Date: Thu, 25 Apr 1991 19:41:19 GMT
Lines: 5

In the Bourne shell AND if not more than one background job is running

	if [ "$$" -eq "$!" ]

will be true if the job is in the background.
