1

For example, write standard err and standard output to $LOG. but this not print anything to standard output ( on console )

#!/bin/bash

LOG=/var/tmp/log

#...

exec > $LOG  2>&1

my target is to write to $LOG on any standard output and standard err but on the same time to standard output ( on console ). Is it possible?

shalom
  • 451
  • 12
  • 26

1 Answers1

1

Maybe try this

stdout:

$ date -e 2>&1 |tee log
date: invalid option -- 'e'
Try date --help for more information.

Log file:

$ cat log
date: invalid option -- 'e'
Try date --help for more information.
Thomas
  • 4,155
  • 5
  • 21
  • 28
Tux_DEV_NULL
  • 1,083
  • 7
  • 11