3 ms·
thing | thing | thing > /file/I/didnt/mean/to/smash | thing oops thing | thing | thing > /another/file/I/didnt/mean/to/smash oops if you include > redirecti
by ggm 8y ago
thing | thing | thing > /file/I/didnt/mean/to/smash | thing
oops
thing | thing | thing > /another/file/I/didnt/mean/to/smash
oops
if you include > redirection, its parsed and processed before execution of the pipe. Even if the subsequent pipe execution moments fail, you have probably smashed /thing/you/didnt/mean/to/smash if you > into it
- masklinn 8y agoWhich is why setting "noclobber" is really useful and oft time-saving.
- ayosec 8y agosponge[1] is very useful in this scenario. The output file is written only when the `thing | thing | thing` finishes successfully. [1]: https://linux.die.net/man/1/sponge https://linux.die.net/man/1/sponge