What shell is running?

Steve Summit scs at adam.pika.mit.edu
Thu Feb 23 13:28:04 AEST 1989


In article <299 at athertn.Atherton.COM> paul at athertn.Atherton.COM
(Paul Sander) asks how to determine which shell has invoked an
interactive application, to prevent certain core dumps under
various combinations of input redirection, background invocation,
etc.  He considers making this decision based on the line
discipline in use, but Guy Harris reminds him that this won't
necessarily work

	...on systems with job-control shells other than "csh",
	such as the Korn shell or the BRL Bourne shell (or the S5R4 Bourne
	shell).

Consider, too, that there are twisted reactionaries like me who
use the new line discipline but stick with the Bourne shell.

The first thing to look at is stdin: background processes invoked
by sh have stdin connected to /dev/null, while under csh stdin
remains connected to the terminal, but in a different process
group so that attempted reads result in SIGTTIN.  If the process
group related signals under the new driver don't get you,
attempted ioctl's on a /dev/null stdin under sh probably will.

"Simple" programs don't have these problems, but those that deal
specially with the terminal driver have to be careful.

                                            Steve Summit
                                            scs at adam.pika.mit.edu



More information about the Comp.unix.wizards mailing list