【发布时间】:2012-03-11 15:18:25
【问题描述】:
我有一些输入可以说“somespacehere .file somemorespace”sample.cpp“”。 上面的行我想使用 shell 脚本写在一个文件中。 我应该如何编写 shell 脚本? 请帮我。 谢谢。
我写了一个代码
#!/bin/bash
filename= "./xyz.txt"
file = open(filename,'w')
echo " .file \"sample.cpp\"" > file
file .close()
它给了我错误
语法错误:“(”意外 在最后一行。
【问题讨论】:
-
不清楚你在这里问什么。您是否希望将多个命令连接成一行?您是否希望将一个命令的输出作为参数传递给另一个?
-
我只想将字符串 startshere somespace .file somemorespace "sample.cpp" stringendshere 写入文件。