Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!boulder!stan!dce From: dce@Solbourne.COM (David Elliott) Newsgroups: comp.unix.wizards Subject: Re: Unlinked temp files in sh scripts Message-ID: <878@marvin.Solbourne.COM> Date: 25 Apr 89 22:43:18 GMT References: <871@marvin.Solbourne.COM> Reply-To: dce@Solbourne.com (David Elliott) Organization: Solbourne Computer Inc., Longmont, Colorado Lines: 18 In article <871@marvin.Solbourne.COM> dce@Solbourne.com (David Elliott) writes: > >After this has been done, fd 4 is still a read descriptor >pointing at the beginning of the temp file, so you can >read the data in the file by redirecting from fd 4, or, >if you need to read it multiple time, by dup'ing fd 4 >("exec 5<&4", for example, to copy it to fd 5). Oops. Looks like I screwed up here. You can't do an "exec 5<&4" because 5 and 4 will still point to the same place. Instead, you have to do multiple redirections before the temp file is removed. This is kind of sad, but I don't think you generally need to make more than a couple of passes on the temp file. -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce