我有以下make文件,我认为它是一个shell脚本。Unix shell bash脚本无法放入echo调试语句
我试图循环通过FILE_DIR
来执行一些操作。不过,我觉得这个实现并不像预期的那样工作。所以我试图插入一些echo
断点。
来源:
# Target to recurse through the DIR_LIST and make each makefile found in that DIRS
ALLDIRS:
for se in $(FILE_DIR); do \
if [ -d $se ]; then \
cd $se; \
$(MAKE) -f Makefile.mk all; \
cd ..; \
fi \
done
运行:
$ make -f Makefile.batch
h: syntax error at line 3: `then' unexpected
*** Error code 2
The following command caused the error:
for se in `ls -p /app/internal|grep "/"`; do \
echo "Test" \
if [ -d e ]; then \
cd e; \
/usr/ccs/bin/make -f Makefile.mk all; \
cd ..; \
fi \
done
make: Fatal error: Command failed for target `ALLDIRS'
我能请得到帮助这一点。想插入一个echo
断点。
我没有看到你的'echo'语句的问题,而是你的'if'语句是两个版本之间的不同。 – tjameson
我无法重现此错误。尝试一个更简单的命令。 – Beta
@tjameson第二个版本是make的输出,完全显示了我的答案中的第二点。 –