我有一个脚本,它将命令的输出与之前运行的相同命令的输出进行比较,它在大多数情况下都可以工作,但时不时地无法按预期工作。
我已经能够在一个测试线上重现这个问题。我知道我可以轻松地将其分解为比较两个单独的文件,问题就会消失,但我想了解这里实际发生了什么,以及是否有办法以我的方式实现我想要实现的目标我正在努力实现它。
下面是我多次运行的命令的输出,您可以看到它在其中一种情况下回显“test”,但大多数时候它按预期工作。
root@dev:~# comm -13 /tmp/test <(echo '"test"' | cut -d'"' -f2 | sort -u | tee /tmp/test)
root@dev:~# comm -13 /tmp/test <(echo '"test"' | cut -d'"' -f2 | sort -u | tee /tmp/test)
root@dev:~# comm -13 /tmp/test <(echo '"test"' | cut -d'"' -f2 | sort -u | tee /tmp/test)
root@dev:~# comm -13 /tmp/test <(echo '"test"' | cut -d'"' -f2 | sort -u | tee /tmp/test)
root@dev:~# comm -13 /tmp/test <(echo '"test"' | cut -d'"' -f2 | …
Run Code Online (Sandbox Code Playgroud)