【发布时间】:2015-05-11 15:42:01
【问题描述】:
直接粘贴到我的 shell 中,以下尝试了 3 个正则表达式中的每一个并且可以正常工作(请参阅*.{jpg,png,gis.tif}):
for file in ./output/India/*.{jpg,png,gis.tif}; do echo $file; openssl base64 -in $file -out ./output/India/`basename $file`.b64; done;
作为一个makefile进程,它失败并返回:
task:
for file in ./output/India/*.{png,jpg,gis.tif} ; \
do echo $$file ; openssl base64 -in $$file -out ./output/India/`basename $$file`.b64; \
done
然后返回:
47910543179104:error:02001002:system library:fopen:No such file or directory:bss_file.c:398:fopen('./output/India/*.{png,jpg,gis.tif}','r')
为什么当 Bash 在 makefile 中时这个表达式不起作用?
【问题讨论】:
-
提示:如果你发现自己在 make 中编写了一个 shell
for循环,那么你可能做错了。在这里,您将.png转换为.b64(例如)。这听起来像是 make 的直接工作。这样做有很多好处:增量构建、并行操作、错误检查...... -
@bobbogo:谢谢你的评论,你有什么实际的例子可以展示/链接,以便我们学习你的方法吗?随时以您处理此问题的方式发布答案,这将对善意的学习者有所帮助,我肯定会 +1。