Jon*_*son 1 linux bash shell tee
我正在尝试计算命令中的行数,并且我还想查看经过的行数。我最初的想法是使用tee命令:
complicated_command | tee - | wc -l
Run Code Online (Sandbox Code Playgroud)
但这只是使用 GNU 将行数加倍tee或将输出复制到-在 Solaris 上命名的文件中。
complicated_command | tee /dev/tty | wc -l
Run Code Online (Sandbox Code Playgroud)
但请记住,如果您将它放在脚本中并重定向输出,它不会按照您的预期运行。