Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!noose.ecn.purdue.edu!en.ecn.purdue.edu!irick From: irick@ecn.purdue.edu (GarBear Irick) Newsgroups: comp.unix.questions Subject: Re: Closing only stderr in a sh(1) command. Message-ID: <1990May2.000457.9488@ecn.purdue.edu> Date: 2 May 90 00:04:57 GMT References: <1605@dinl.mmc.UUCP> Organization: Purdue University Engineering Computer Network Lines: 19 In article <1605@dinl.mmc.UUCP> noren@dinl.UUCP (Charles Noren) writes: >What I want to do is: > > ls *.o | some-util > >so that if there is no *.o files, it will not be reported. >In other words, can I close only stderr (or redirect it to >/dev/null) while keeping stdin and stdout unaffected? Call me silly, but this should work... ( ls *.o > /tmp/lsfile$$ ) >& /dev/null;cat /tmp/lsfile$$ | some-util I can't think of a one-statement equivalent that will do it off of the top of my head. If anyone comes up with a better solution, PLEASE post it... Just don't exceed the 4000 degrees F limit on my anti-flame unit. Gary A. Irick, irick@en.ecn.purdue.edu Purdue University Engineering Computer Network