如何在 make 中通过从其他程序输出工作的重定向来制作差异

How to make diff with redirection from other program output work in make

如何使下面的命令在 makefile 中工作

diff  "./test0.out" < (./myprog < ./textfile.txt)

我有语法错误

/bin/sh: 1: Syntax error: "(" unexpected

我一直在寻找解决方案有一段时间了,但我没有找到类似的东西。

假设您正在尝试进行进程替换,您有两个问题:

  • 如果您的 sh 不是 bashkshzsh),您不能使用进程替换,因为它未定义通过 POSIX

  • <和后面的(

  • 之间不能有任何空格

假设 bash,执行:

diff  "./test0.out" <(./myprog < ./textfile.txt)