Linux 为什么wdiff不能与命名管道一起工作

Linux 为什么wdiff不能与命名管道一起工作,linux,bash,diff,Linux,Bash,Diff,我怎么能在bash中做到这一点: $ diff -u <(echo -e "line1\nline2") <(echo -e "line1\nline3") --- /dev/fd/63 2009-03-30 09:49:07.527272646 +0100 +++ /dev/fd/62 2009-03-30 09:49:07.527272646 +0100 @@ -1,2 +1,2 @@ line1 -line2 +line3 $diff-u我猜wdiff是坏的。一个str

我怎么能在bash中做到这一点:

$ diff -u <(echo -e "line1\nline2") <(echo -e "line1\nline3")
--- /dev/fd/63  2009-03-30 09:49:07.527272646 +0100
+++ /dev/fd/62  2009-03-30 09:49:07.527272646 +0100
@@ -1,2 +1,2 @@
 line1
-line2
+line3

$diff-u我猜wdiff是坏的。

一个
strace
显示
wdiff
stat
s文件(可能是为了找出它们的大小)。由于命名管道报告的大小为0,因此可能假定两个文件都为空,因此相等:

$ strace -efile wdiff -1 <(echo -e "line1\nline2") <(echo -e "line1\nline3") 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", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 open("/dev/fd/62", O_RDONLY) = 4 open("/tmp/wdiff.5nma9j", O_RDWR|O_CREAT|O_EXCL, 0600) = 5 --- SIGCHLD (Child exited) @ 0 (0) --- unlink("/tmp/wdiff.MzPXmH") = 0 unlink("/tmp/wdiff.5nma9j") = 0 {++}Process 27699 detached
$strace-efile wdiff-1我也可以复制。diff也对文件进行了统计,但仍然有效。有趣的是,这个答案应该被否决,因为被接受的答案证明wdiff确实被破坏了。这可能是因为仅仅声明并没有多大帮助(请注意,我没有投否决票)。 $ strace -efile wdiff -1 <(echo -e "line1\nline2") <(echo -e "line1\nline3") 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", {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 open("/dev/fd/62", O_RDONLY) = 4 open("/tmp/wdiff.5nma9j", O_RDWR|O_CREAT|O_EXCL, 0600) = 5 --- SIGCHLD (Child exited) @ 0 (0) --- unlink("/tmp/wdiff.MzPXmH") = 0 unlink("/tmp/wdiff.5nma9j") = 0 {++}Process 27699 detached