Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!texbell!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.unix.questions Subject: Re: Diffs to the Frequently Asked Questions postings Message-ID: <5OG4:O@xds13.ferranti.com> Date: 5 Jul 90 20:02:28 GMT References: <49557@iuvax.cs.indiana.edu> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 10 In article <49557@iuvax.cs.indiana.edu> sahayman@iuvax.cs.indiana.edu (Steve Hayman) writes: > ! 22) How can a process detect if it's running in the background? First of all: do you want to know if you're running in the background, or if you're running interactively? If you're deciding whether or not you should print prompts and the like, that's probably a better criterion. Check if standard input is a terminal: sh: if [ -t 0 ]; then ... fi C: if(isatty(0)) { ... } -- Peter da Silva. `-_-' +1 713 274 5180.