这段代码中的“cat -”是什么意思?
What does `cat -` mean in this snippet?
echo -n x | cat - pipe1 > pipe2 &
cat <pipe2 > pipe1
cat
首先从标准输入 (-
) 生成 "x",然后是 pipe1
提供的任何名称。
用第二个 cat 命令跟随它是非常疯狂的,因为 "x" 在两只猫之间跳来跳去。 Vaught 在 1997 年解释说:
both cat programs are running like crazy copying the letter x back and forth in an endless loop.
echo -n x | cat - pipe1 > pipe2 &
cat <pipe2 > pipe1
cat
首先从标准输入 (-
) 生成 "x",然后是 pipe1
提供的任何名称。
用第二个 cat 命令跟随它是非常疯狂的,因为 "x" 在两只猫之间跳来跳去。 Vaught 在 1997 年解释说:
both cat programs are running like crazy copying the letter x back and forth in an endless loop.