Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Oct 2009 23:58:59 +0200
From:      Polytropon <freebsd@edvax.de>
To:        Stefan Miklosovic <miklosovic.freebsd@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: error output redirection
Message-ID:  <20091011235859.69bb0a08.freebsd@edvax.de>
In-Reply-To: <f99a79ec0910111436g62b93acfg873771c04b6b9b1e@mail.gmail.com>
References:  <f99a79ec0910111436g62b93acfg873771c04b6b9b1e@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 11 Oct 2009 23:36:52 +0200, Stefan Miklosovic <miklosovic.freebsd@gmail.com> wrote:
> hi list,
> 
> if error output of some program appear on screen,
> it is possible to print it also to some file simultaneously ?
> 
> e.g
> if I "cat" file which do not exist, error is on screen,
> I want to add that error to some file (errors.txt)

See "man sh" (or "man bash" if you use it): The redirection
could be this:

	$ cat nonexist.txt > error.txt 2>&1

The C shell has a different syntax:

	% cat nonexist.txt >& error.txt

I hope that's what you have requested. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20091011235859.69bb0a08.freebsd>