From owner-freebsd-questions Tue Jan 15 9:34:29 2002 Delivered-To: freebsd-questions@freebsd.org Received: from smtp.hccnet.nl (smtp.hccnet.nl [62.251.0.13]) by hub.freebsd.org (Postfix) with ESMTP id 948EE37B404 for ; Tue, 15 Jan 2002 09:34:24 -0800 (PST) Received: from there by smtp.hccnet.nl via fia168-94.dsl.hccnet.nl [62.251.94.168] with SMTP id SAA01899 (8.8.8/1.13); Tue, 15 Jan 2002 18:34:20 +0100 (MET) Message-Id: <200201151734.SAA01899@smtp.hccnet.nl> Content-Type: text/plain; charset="iso-8859-1" From: Simon Siemonsma To: adrian kok Subject: Re: /dev/null 2>&1 Date: Tue, 15 Jan 2002 18:39:35 +0000 X-Mailer: KMail [version 1.3.2] References: <20020115171821.89227.qmail@web21208.mail.yahoo.com> In-Reply-To: <20020115171821.89227.qmail@web21208.mail.yahoo.com> Cc: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG The difference is that with Bourne Shells there are two types of output: the normal output errors The way you sometimes do will redirect the standard output to the file buildworld.log. The other way will also direct the errors to that file, instead of to the console. Simon Siemonsma On Tuesday 15 January 2002 17:18, you wrote: > Dear > > Thank you very much for your reply > > I also have question about it > > What is the advantage and the different > /dev/null 2>&1 > > Sometimes I only use this one > > make buildworld >buildworld.log > not > make buildworld >buildworld.log 2>&1 & > > Thank you again > > > > > > --- Giorgos Keramidas wrote: > > > On 2002-01-15 01:33:04, adrian kok wrote: > > > Dear all > > > > > > What is the meaning of /dev/null 2>&1 > > > > > > Thank you > > > > You'll see constructs like this in scripts that > > read: > > > > command >/dev/null 2>&1 > > > > That is a Bourne shell idiom (does not work in CSH > > and friends), that > > means ``redirect standard output to /dev/null'' and > > then ``redirect > > file-descriptor 2 (stderr) to the same place as 1 > > (stdout)''. > > > > The purpose of all this is to stop `command' from > > producing *any* kind > > of output, on standard output and error. > > > > Another use could be to save all output from a > > command in a file, both > > standard output and standard error. I customarily > > build my kernels > > and update my FreeBSD systems with commands like > > this: > > > > # cd /usr/src > > # make buildworld >buildworld.log 2>&1 & > > # logout > > > > Then after buildworld finishes ... > > > > # cd /usr/src > > # make buildkernel >buildkernel.log 2>&1 & > > # logout > > > > This way, all output from `make buildworld' is saved > > in the file > > /usr/src/buildworld.log and all output from `make > > buildkernel' is > > saved in /usr/src/buildkernel.log. A few hours > > later, I can browse > > the file for interesting messages. > > > > Cheers, > > > > -- > > Giorgos Keramidas . . . . . . . . . > > keramida@{ceid.upatras.gr,freebsd.org} > > FreeBSD Documentation Project . . . > > http://www.freebsd.org/docproj/ > > FreeBSD: The power to serve . . . . > > http://www.freebsd.org/ > > > > > > ATTACHMENT part 2 application/pgp-signature > > _______________________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com.hk address at http://mail.english.yahoo.com.hk > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message