作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个带有 for 循环的 Makefile。问题是当循环内发生错误时,执行继续。
SUBDIRS += $(shell ls -d */ | grep amore)
# breaks because can't write in /, stop execution, return 2
test:
mkdir /
touch /tmp/zxcv
# error because can't write in / but carry on, finally return 0
tests:
@for dir in $(SUBDIRS); do \
mkdir / ; \
touch /tmp/zxcv ; \
done;
最佳答案
要么添加 || exit 1
对每个可能失败的调用或您执行 set -e
在规则的开头:
tests1:
@dir in $(SUBDIRS); do \
mkdir / \
&& touch /tmp/zxcv \
|| exit 1; \
done
tests2:
@set -e; \
for dir in $(SUBDIRS); do \
mkdir / ; \
touch /tmp/zxcv ; \
done
关于for-loop - Makefile:for 循环并在出错时中断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16060338/
安装并修复我的 VS2015 实例后,我仍然无法让智能感知(服务器端)在我的 MVC View 中工作。当我在 session 中第一次打开 .cshtml 文件并找到 Activitylog 文件时
我是一名优秀的程序员,十分优秀!