Date: Mon, 14 Jan 2002 23:10:29 +0200 From: Giorgos Keramidas <keramida@freebsd.org> To: adrian kok <adriankok2000@yahoo.com.hk> Cc: questions@freebsd.org Subject: Re: /dev/null 2>&1 Message-ID: <20020114211029.GD31045@hades.hell.gr> In-Reply-To: <20020114173304.68462.qmail@web21210.mail.yahoo.com> References: <20020114173304.68462.qmail@web21210.mail.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020114211029.GD31045>