From owner-freebsd-questions Mon Jan 14 14:42:25 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by hub.freebsd.org (Postfix) with ESMTP id CFA5E37B427 for ; Mon, 14 Jan 2002 14:41:38 -0800 (PST) Received: from hades.hell.gr (patr530-a233.otenet.gr [212.205.215.233]) by mailsrv.otenet.gr (8.11.5/8.11.5) with ESMTP id g0EMfZY08286; Tue, 15 Jan 2002 00:41:35 +0200 (EET) Received: (from charon@localhost) by hades.hell.gr (8.11.6/8.11.6) id g0ELATe31803; Mon, 14 Jan 2002 23:10:29 +0200 (EET) (envelope-from keramida@freebsd.org) Date: Mon, 14 Jan 2002 23:10:29 +0200 From: Giorgos Keramidas To: adrian kok Cc: questions@freebsd.org Subject: Re: /dev/null 2>&1 Message-ID: <20020114211029.GD31045@hades.hell.gr> References: <20020114173304.68462.qmail@web21210.mail.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Hf61M2y+wYpnELGG" Content-Disposition: inline In-Reply-To: <20020114173304.68462.qmail@web21210.mail.yahoo.com> User-Agent: Mutt/1.3.25i 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 --Hf61M2y+wYpnELGG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2002-01-15 01:33:04, adrian kok wrote: > Dear all >=20 > What is the meaning of /dev/null 2>&1 >=20 > 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, --=20 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/ --Hf61M2y+wYpnELGG Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) iD8DBQE8Q0lF1g+UGjGGA7YRAlzHAJ9K+7iqfGNDIQkSvSFBVXWqgzqtiACgoqVf fetqdgLKPuHO4DNa/5aCDC4= =L0BM -----END PGP SIGNATURE----- --Hf61M2y+wYpnELGG-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message