Diffs to the Frequently Asked Questions postings
Peter da Silva
peter at ficc.ferranti.com
Fri Jul 6 06:02:28 AEST 1990
In article <49557 at iuvax.cs.indiana.edu> sahayman at 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.
<peter at ficc.ferranti.com>
More information about the Comp.unix.questions
mailing list