Date: Wed, 16 Jan 2002 01:18:21 +0800 (CST) From: =?iso-8859-1?q?adrian=20kok?= <adriankok2000@yahoo.com.hk> To: Giorgos Keramidas <keramida@freebsd.org> Cc: questions@freebsd.org Subject: Re: /dev/null 2>&1 Message-ID: <20020115171821.89227.qmail@web21208.mail.yahoo.com> In-Reply-To: <20020114211029.GD31045@hades.hell.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <keramida@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020115171821.89227.qmail>
