3
在我的makefile,我有一個目標叫indent-fast
-爲什麼在執行過程中出現腳本和註釋?
indent-fast:
# astyle --style=allman --indent=tab `find . -name "*.java"`
files=`find . -name "*.java"` ; \
for file in $$files ; do \
echo formatting $$file ; \
done ;\
# to do a whitesmith at 4 spaces, uncomment this line --
# astyle --style=whitesmith --indent=spaces=4 `find . -name "*.java"`
但是當我執行它,我得到這個輸出 -
[email protected]:~$ make indent-fast
# astyle --style=allman --indent=tab `find . -name "*.java"`
files=`find . -name "*.java"` ; \
for file in $files ; do \
echo formatting $file ; \
done ;\
formatting ./File1.java
formatting ./File2.java
formatting ./File3.java
.
.
.
formatting ./FileN.java
# to do a whitesmith at 4 spaces, uncomment this line --
# astyle --style=whitesmith --indent=spaces=4 `find . -name "*.java"`
爲什麼它顯示與評論沿着腳本在標準輸出?另請注意,indent-fast
是該文件中的最後一個目標。
好吧,謝謝我可以用'@'來壓制註釋,但它仍然顯示'for'循環體a nd也會拋出這個錯誤'/ bin/sh:5:@#:找不到make:*** [indent-fast] Error 127' – ramgorur
如果你不想'for'循環體,可以放一個'@'在它包含的命令前面。你得到錯誤的原因是你在錯誤的地方放了一個'@',而shell正在試圖解釋它。 –
只需添加:如果您不希望打印它們,請不要用TAB縮進它們。如果它沒有用TAB縮進,那麼它不是配方的一部分,它是'make'註釋,make不會將它傳遞給shell。 – MadScientist