一个strace显示wdiff统计文件(可能是为了找出它们的大小).由于命名管道报告大小为0,因此可能假设两个文件都是空的,因此相等:
$strace -efile wdiff -1
execve("/usr/bin/wdiff",["wdiff","-1","/dev/fd/63","/dev/fd/62"],[/* 44 vars */]) = 0
[snip uninteresting stuff]
stat64("/dev/fd/63",{st_mode=S_IFIFO|0600,st_size=0,...}) = 0
open("/dev/fd/63",O_RDONLY) = 3
open("/tmp/wdiff.MzPXmH",O_RDWR|O_CREAT|O_EXCL,0600) = 4
stat64("/dev/fd/62",...}) = 0
open("/dev/fd/62",O_RDONLY) = 4
open("/tmp/wdiff.5nma9j",0600) = 5
--- SIGCHLD (Child exited) @ 0 (0) ---
unlink("/tmp/wdiff.MzPXmH") = 0
unlink("/tmp/wdiff.5nma9j") = 0
{++}Process 27699 detached
编辑:还要注意,如果内核支持bash,bash可以使用/ dev / fd样式的文件名而不是命名管道(最新的那些,上面的例子显示了这一点),但效果几乎相同.