4
使用QMake,我读了一些锅炉板代码,进行修改并将修改后的代码写入文件。 但是,我得到了很奇怪的结果。我已将问题简化为以下内容:QMake - 不稳定的行为当使用回声系统命令
# Open boiler plate file
interfaceBoilerPlateCode = $$cat($$boilerPlateFile, blob)
# Make sure we read the right content
message("Content read: $$interfaceBoilerPlateCode")
# Write the read text into a file
output = $$system(echo $$interfaceBoilerPlateCode >> $$targetFile) # Doesnt work
output = $$system(echo "Howde" >> $$targetFile) # This works
正在读取的文件是仅包含字符串“Howde”的纯文本文件。 文件的内容被正确读取。但是,当我尝试将文件的内容写入另一个目标文件时,我得不到任何输出(字面意思:没有错误/警告,但没有生成新文件)。然而,如果我只用代码中定义的字符串(如上面代码片段的最后一行)使用echo,则会在其中使用字符串“Howde”生成一个新文件。
这是怎么回事?我做错了倒数第二行不生成新文件?
是否$$ interfaceBoilerPlateCode'需要在为'echo'命令双引号? – cmannett85 2014-10-06 12:02:55
已经试过了。没有效果。 – balajeerc 2014-10-06 12:06:11