作者:曾经 | 来源:互联网 | 2024-11-06 16:46
We need a containers.exited.tmp file because if you put the source-file as the output-file the resul
We need a containers.exited.tmp file because if you put the source-file as the output-file the result will (depending on bash?) be an empty file.
Bad:
1 2 3 4 5 6 7 8 9 10
| bash
$cat containers.exited
123
456
789
$ cat containers.dead
789
$ comm -23 containers.exited containers.dead > containers.exited
$ cat containers.exited
(empty file) |
Good:
1 2 3 4
| $comm -23 containers.exited containers.dead > containers.exited_tmp
$cat containers.exited_tmp
123
456 |
该提问来源于开源项目:spotify/docker-gc
ah I missed that the command is trying to redirect to the same file that
is reading from. Thanks for catching this!