Zombo
Zombo

Reputation: 1

Pipe to multiple files, but not stdout

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

Upvotes: 16

Views: 9537

Answers (2)

Jirka
Jirka

Reputation: 405

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.

Upvotes: 7

anishsane
anishsane

Reputation: 20980

You can simply use:

echo 'hello world' | tee aa bb > cc 

Upvotes: 20

Related Questions