Wil*_*ire 1 command-line pipe io-redirection tee
我正在使用该tee
命令将程序的编译错误与终端一起输出到文件中。
gcc hello.c | tee file.txt
Run Code Online (Sandbox Code Playgroud)
这是我用过的命令。编译错误显示在终端上,但不会输出到文件中。我应该如何将 std 错误输出到文件中?
随着csh
,tcsh
,zsh
或最新版本bash
,尝试
gcc hello.c |& tee file.txt
Run Code Online (Sandbox Code Playgroud)
在哪里
在其他类似 Bourne 的 shell 中:
gcc hello.c 2>&1 | tee file.txt
Run Code Online (Sandbox Code Playgroud)
在rc
--like shell:
gcc hello.c >[2=1] | tee file.txt
Run Code Online (Sandbox Code Playgroud)
在fish
外壳中:
gcc hello.c ^&1 | tee file.txt
Run Code Online (Sandbox Code Playgroud)