Skip to main content
other shells for completeness
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

With csh, tcsh, zsh or recent versions of bash, try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

In other Bourne-like shells:

gcc hello.c 2>&1 | tee file.txt

In rc-like shells:

gcc hello.c >[2=1] | tee file.txt

In the fish shell:

gcc hello.c ^&1 | tee file.txt

With csh, tcsh, zsh or recent versions of bash, try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

In other Bourne-like shells:

gcc hello.c 2>&1 | tee file.txt

With csh, tcsh, zsh or recent versions of bash, try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

In other Bourne-like shells:

gcc hello.c 2>&1 | tee file.txt

In rc-like shells:

gcc hello.c >[2=1] | tee file.txt

In the fish shell:

gcc hello.c ^&1 | tee file.txt
added 117 characters in body
Source Link
Stéphane Chazelas
  • 584.9k
  • 96
  • 1.1k
  • 1.7k

With csh, tcsh, zsh or recent versions of bash, try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

In other Bourne-like shells:

gcc hello.c 2>&1 | tee file.txt

try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

With csh, tcsh, zsh or recent versions of bash, try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.

In other Bourne-like shells:

gcc hello.c 2>&1 | tee file.txt
Source Link
Archemar
  • 32.3k
  • 18
  • 75
  • 107

try

gcc hello.c |& tee file.txt

where

  • |& instruct the shell to redirect standard error to standard output.