Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!icom!xwkg.Icom.Com!andy From: andy@xwkg.Icom.Com (Andrew H. Marrinson) Newsgroups: comp.bugs.sys5 Subject: Nasty bug in release 4 Bourne shell Summary: Using null execs to redirect I/O in a while loop loses! Keywords: Bourne shell, exec, redirection Message-ID: Date: 27 Dec 90 23:00:20 GMT Sender: news@icom.icom.com (News Feed) Organization: Icom Systems, Inc. Lines: 41 In the process of porting smail3.1.19 to System V release 4, I found a very nasty bug! If you use exec to redirect output in a while loop (as in ``exec >/tmp/foo'', that is an exec with no command), it only seems to obey the first such redirection. I RTFM and it gives me no reason to believe this is other than a bug. (Note: this is Bourne shell. I haven't checked ksh yet.) Here is a short shell script that reproduces the behavior: while read b; do exec > $b cat <