4 ms·
Somewhat off-topic, could somebody explain why echo 3 | tee /proc/sys/vm/drop_caches rather than just echo 3 > /proc/sys/vm/drop_caches Is it because th
by julian37 15y ago
Somewhat off-topic, could somebody explain why
echo 3 | tee /proc/sys/vm/drop_caches
rather than just
echo 3 > /proc/sys/vm/drop_caches
Is it because the output to stdout lets you be extra sure that the right data was sent to the kernel?
I'm just wondering if this is an idiom with a deeper meaning that I'm not aware of.
EDIT: I'm guessing that when you run it in a script (without set -x), rather than on the command line, you can see in the log what it is you sent?
- pdw 15y agoBecause you can echo 3 | sudo tee /proc/sys/vm/drop_caches but sudo echo 3 > /proc/sys/vm/drop_caches won't work.
- jochu 15y agoAside from reasons you mentioned, I can imagine it being because it easily allows one to add a sudo or being habit because of it. For example: echo 3 | sudo tee /proc/sys/vm/drop_caches Will allow you to write as root and sudo echo 3 > /proc/sys/vm/drop_caches Will be a permission error. It executes the echo as root and the write as the user