Makefile while 循环
即使将 SHELL 设置为 bash 而不是 sh 后,以下内容也不起作用:
doc:
while read line; do \
eval echo "$$line" > $(DOC) \
done < $(DOC).templ
/bin/bash: -c: line 3: syntax error: unexpected end of file
我想做的是拥有一个包含 bash 参数理解的模板文件,例如 ($()
, $ {}
)并在编译时“构建”它。有更好的方法吗?
Even after setting SHELL to bash instead of sh, the following does not work:
doc:
while read line; do \
eval echo "$line" > $(DOC) \
done < $(DOC).templ
/bin/bash: -c: line 3: syntax error: unexpected end of file
What I'm trying to do is have a template file with bash parameter comprehensions and such ($()
, ${}
) and "build" it at compile time. Is there a better way to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
完成之前您缺少一个分号:
You are missing a semicolon before done:
这个答案可能会迟到;-),但我认为另一个问题是您的输出重定向位于错误的位置:
This answer might come to late ;-), but I think another problem is that your output redirection is in the wrong position: