allbery@NCoast.ORG (Brandon S. Allbery) (11/10/89)
As quoted from <4094@phri.UUCP> by roy@phri.UUCP (Roy Smith): +--------------- | Why do I get "illegal io" when I do "read x < /dev/tty" in a shell | file under MtXinu 4.3BSD/NSF on a Vax-11/750? It works fine under | SunOS-3.5.2 on a 3/50. It doesn't seem to matter if I use the generic | /dev/tty or the specific pseudo-tty I'm on. For example: +--------------- The V7-vintage /bin/sh, from which 4.xBSD sh is derived, can only redirect built-ins if they are executed in a subprocess. Thus, you can not redirect the "read" command, and redirecting into or out of a loop causes that loop to execute in a subshell as if you enclosed it in (). The System V /bin/sh, which was picked up by Sun, does some trickery with stashing the shell's own stdin/stdout/stderr elsewhere via dup2() (actually, fcntl(F_DUPFD), but...), in order to allow built-in commands to be redirected without the shell losing the undirected fd's. ++Brandon -- Brandon S. Allbery allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu bsa@telotech.uucp *(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)* *Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)* >>> The *.aquari* debate: news.groups gone news.playpen <<<