Uso del comando tee

Uso del comando tee


documentación de hombre

TEE(1)                    BSD General Commands Manual                   TEE(1)

NAME
     tee -- pipe fitting

SYNOPSIS
     tee [-ai] [file ...]

DESCRIPTION
     The tee utility copies standard input to standard output, making a copy
     in zero or more files.  The output is unbuffered.

     The following options are available:

     -a      Append the output to the files rather than overwriting them.

     -i      Ignore the SIGINT signal.

     The following operands are available:

     file  A pathname of an output file.

     The tee utility takes the default action for all signals, except in the
     event of the -i option.

     The tee utility exits 0 on success, and >0 if an error occurs.

STANDARDS
     The tee function is expected to be POSIX IEEE Std 1003.2 (``POSIX.2'')
     compatible.

BSD                              June 6, 1993                              BSD

Resumen

En pocas palabras, es un comando para salida bidireccional. Tome el siguiente comando como ejemplo:
touch test2 && cat test1 | tee test2 > /dev/null
Primero, creé un nuevo archivo test2, y luego usé el contenido del archivo en test1 como la entrada estándar del comando tee a través de la tubería. Luego, el comando tee sobrescribe el contenido de entrada al archivo test2, y luego redirige el contenido de salida que debe enviarse a la salida estándar al agujero, por lo que no se puede ver el contenido de salida de la salida estándar.

316 artículos originales publicados · Me gusta 28 · Visita 130,000+

Supongo que te gusta

Origin blog.csdn.net/qq_31433709/article/details/105591139
Recomendado
Clasificación