在 bash 文件中,我可以这样写:
my_program << EOF
Some test
More test
A lot of multi-line text
EOF
这将启动 my_program 可执行文件并通过管道将三行(或更多)文本传递给它。
现在我想在 Makefile (GNU make) 中做同样的事情。我没有找到标准解决方案,它是这样解决的:
LaunchMyProgram:
echo -en "Some test\\nMore test\\nA lot of multi-line text\\n" | my_program
但这看起来非常难看。有没有更精细的解决方案?