> sponge Why not use > file? > mispipe In bash there's PIPESTATUS for that.
> Why not use > file? This, I learned the hard way, and I am not the only one. So in order for you not to make that mistake: the first thing that happens is that "file" is truncated, that happens before any command is run, so sed s/foo/bar/ file > file will always result in an empty "file", because it will be truncated before "sed" is run. I lost a couple of hours of work like that, once, and then I learned. From the…
sed s/foo/bar/ -i file
to edit file.