Skip to main content
stderr
Source Link
sebasth
  • 15.8k
  • 6
  • 53
  • 71

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

In bash you can use process substitution in following way to copy output to $LOG:

exec >&> >(tee $LOG)

However this bashism won't work on other shells.

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

In bash you can use process substitution in following way to copy output to $LOG:

exec > >(tee $LOG)

However this bashism won't work on other shells.

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

In bash you can use process substitution in following way to copy output to $LOG:

exec &> >(tee $LOG)

However this bashism won't work on other shells.

added 163 characters in body
Source Link
sebasth
  • 15.8k
  • 6
  • 53
  • 71

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

In bash you can use process substitution in following way to copy output to $LOG:

exec > >(tee $LOG)

However this bashism won't work on other shells.

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.

In bash you can use process substitution in following way to copy output to $LOG:

exec > >(tee $LOG)

However this bashism won't work on other shells.

Source Link
sebasth
  • 15.8k
  • 6
  • 53
  • 71

Use tee. For example:

command 2>&1 | tee file.txt

Which runs command redirecting SDTERR to SDTOUT. tee copies STDIN to both STDOUT and to file file.txt.