在 Makefile 中,我想打印一个以十六进制数字表示的字节并将其传递给另一个程序的 STDIN。由于某种原因,它不起作用:
without-pipe:
@printf '\x66\x6f\x6f'
with-bash-and-pipe:
@/bin/bash -c "printf '\x66\x6f\x6f' | cat"
with-pipe:
@printf '\x66\x6f\x6f' | cat
Run Code Online (Sandbox Code Playgroud)
运行该文件会产生:
$ make without-pipe
foo
$ make with-bash-and-pipe
foo
$ make with-pipe
\x66\x6f\x6f
Run Code Online (Sandbox Code Playgroud)
我缺少什么功能make以及使最后一个目标产生相同输出的正确方法是什么。这with-bash-and-pipe是一种解决方法。