On Sun, Oct 11, 2009 at 11:36:52PM +0200, Stefan Miklosovic wrote:
> if error output of some program appear on screen, it is possible to
> print it also to some file simultaneously?

Depends on the program, but generally, yes.


> 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)

Replacing 'cat file_that_does_not_exist' with 'badcommand'

  # redirect STDERR to a file
  badcommand 2> errors.txt

  # append STDERR to a file
  badcommand 2>> errors.txt

  # fun with file descriptors to have it both ways
  badcommand 3>&1 1>&2 2>&3 | tee errors.txt

freebsd-questions@freebsd.org mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to