Path: utzoo!attcan!uunet!samsung!sdd.hp.com!ucsd!ucbvax!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.questions Subject: Re: Closing only stderr in a sh(1) command. Message-ID: <1990May2.042244.13723@athena.mit.edu> Date: 2 May 90 04:22:44 GMT References: <1605@dinl.mmc.UUCP> Sender: news@athena.mit.edu (News system) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Organization: Massachusetts Institute of Technology Lines: 20 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? May I humbly suggest that you RTFM before posting a question like this to the net? I'm fairly certain that the man page sh(1) talks about using the num>file syntax to redirect a specific file descriptor somewhere. In this particular case, you might try: ls *.o 2>/dev/null | some-util Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710