*BSD News Article 64104


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!newshost.nla.gov.au!act.news.telstra.net!psgrain!newsfeed.internetmci.com!news.exodus.net!news.aimnet.com!news.walltech.com!cyberstation.net!usenet
From: Scott Hanes <istrbitl@cyberstation.net>
Newsgroups: comp.unix.questions,comp.unix.bsd.misc,comp.unix.bsd.bsdi.misc
Subject: Re: stderr redirection with BSD Unix
Date: Sat, 23 Mar 1996 12:58:18 -0600
Organization: CyberStation, Inc
Lines: 37
Message-ID: <315449CA.263@cyberstation.net>
References: <31500644.37A7@cyberstation.net>
NNTP-Posting-Host: istrbitl.cyberstation.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0GoldB1 (Win95; I)
Xref: euryale.cc.adfa.oz.au comp.unix.questions:79186 comp.unix.bsd.misc:569 comp.unix.bsd.bsdi.misc:2740

Scott Hanes wrote:
> 
> Hi,
> 
>         I've been trying to redirect stderr in BSD/OS 2.0.1 using System
> V manuals. :(  No dice.  System V says to use  '>' for stdout redirect
> (and stdin redirect to be accurate) and '2>' for stderr redirect.
>         I tried this in BSD unix and it doesn't seem to work. I tried
>                 find / -name <filename> -print > found.txt 2> /dev/null
>   trying to get just what I want without all of the :permission denied
> error messages. When I do so, the message I get is:
>                 find: 2: unknown option.
> 
>         I'm not putting a space between 2 and > It just doen't seem to
> be the correct way to redirect stderr in BSD Unix.. Any ideas what IS
> the right way??
> 
> Much thanks,
> Scott

You learn something new everyday...
	Thanks to everyone who responded by email to my question.  
Incase there's anyone else out there who wanted to the answer to my 
question, here's the gist:

	stderr redirection has nothing to do with which version on Unix 
i'm using. SysV or BSD it doen't matter, what matters it the shell i'm 
using.  I've been using /bin/tcsh which doesnt' support the stderr 
redirect like /bin/sh or /bin/ksh.  The quick fix for this is, for 
example:
  system% /bin/sh -c "find / -name <file> -print > found.txt 2> 
		/dev/null"

invoke /bin/sh temporarily just for the one command.

Thanks again everyone who answered,
Scott