Вопрос

I want to pipe stdout to multiple files, but keep stdout itself quiet. tee is close but it prints to both the files and stdout

$ echo 'hello world' | tee aa bb cc
hello world

This works but I would prefer something simpler if possible

$ echo 'hello world' | tee aa bb cc >/dev/null
Это было полезно?

Решение

You can simply use:

echo 'hello world' | tee aa bb > cc 

Другие советы

You can also close tee stdout output by writing to /dev/full

echo 'hello world' | tee aa bb cc >/dev/full

or by closing stdout.

echo 'hello world' | tee aa bb cc >&-

Be however aware that you will get either tee: standard output: No space left on device or tee: standard output: Bad file descriptor warnings.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top