Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site wjvax.wjvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!pyramid!pesnta!wjvax!brett From: brett@wjvax.UUCP (Brett Galloway) Newsgroups: net.unix-wizards,net.bugs.4bsd Subject: Strange behaviour of /bin/sh -c (4.2 BSD) Message-ID: <661@wjvax.wjvax.UUCP> Date: Thu, 27-Feb-86 13:06:43 EST Article-I.D.: wjvax.661 Posted: Thu Feb 27 13:06:43 1986 Date-Received: Sat, 1-Mar-86 22:43:44 EST Reply-To: brett@wjvax.UUCP (Brett Galloway) Organization: Watkins-Johnson Co., San Jose, Calif. Lines: 33 Keywords: Bourne shell, 4.2BSD Xref: watmath net.unix-wizards:17009 net.bugs.4bsd:1985 I ran across what appears to be strange behaviour in the Bourne shell (sh), when one brings up a program using sh -c. Note that sh -c foo brings up program foo running under /bin/sh. If one does this from the csh, as sh -c foo & as I understand it, that should bring up /bin/sh running foo, in the background, but /bin/sh's stdin and stdout should still be connected to the control terminal. Apparently, even when -c is used, sh thinks it is in interactive mode. That behaviour is questionable enough. What is even more peculiar is that if one brings up sh -c foo NOT connected to a terminal, it still does this! For example, do sh -c foo &/dev/null & from the csh. This puts /bin/sh -c foo with stdin, stdout, and stderr connected to /dev/null, and runs it in the background (which is a nop in this case, since /bin/sh is not connected to the terminal anyhow). It is clear that /bin/sh should not assume that it is interactive, since /dev/null is not a terminal, yet it appears to do so, insofar as it ignores SIGINT. Apparently, the -c flag of sh effectively forces the -i (interactive) flag. What I would like to know is whether this is a bug of /bin/sh, a (mis)feature, or whether I am missing something. Please respond via mail, and I will summarize. Thanks (in advance). ------------- Brett Galloway {pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett