Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 makefile 中编写了以下断言以附加到现有的文本文件。使用nmake工具执行生成文件。
TempFile.txt : >> $@ echo Hello World ! copy /Y ExistingFile.txt+TempFile.txt ExistingFile.txt
以上是有效的,但在最后写了一个额外的字符。
你好呀 ! 你好世界 ! -
额外字符不完全是一个-字符,而是回车符SUB。如何避免呢?有没有其他简单的方法可以将文本附加到现有文件?
-
SUB
您也可以使用管道将文本附加到现有文件的末尾:
TempFile.txt : >> $@ echo Hello World ! type TempFile.txt >> ExistingFile.txt