Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.unix.wizards Subject: Re: Shell scripts - getting parent status in read Message-ID: <869@twwells.uucp> Date: 26 Apr 89 03:38:53 GMT References: <861@marvin.Solbourne.COM> <849@twwells.uucp> <866@marvin.Solbourne.COM> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 39 Summary: Expires: Sender: Followup-To: Distribution: Keywords: In article <866@marvin.Solbourne.COM> dce@Solbourne.com (David Elliott) writes: : In article <849@twwells.uucp> bill@twwells.UUCP (T. William Wells) writes: : >[something stupid]. : : Are you sure about this? No. I have no idea what drugs I had been slipped when I wrote that. Or maybe it's lack of sleep? :-) : I would think this would cause an EOF, and there was some : discussion on this recently, but it doesn't. So would I. And, in fact it does. The problem is that the shell doesn't exit on EOF. I just tested this on my V/386 3.0 Bourne shell. I wrote a little shell: while true do read foo echo "<$foo>" done to see what happens. And what happens is that EOF and newline both set foo to a null string. HEY! I just RTFM. According to it, you get a return status from read! Adding: echo $? before the other echo, I get 0 on a blank line, 1 on EOF. When I feed data through a pipe, it works as expected. (I feel better now I can wipe the egg off my face.) --- Bill { uunet | novavax } !twwells!bill