【发布时间】:2015-12-06 05:55:55
【问题描述】:
从 Ruby 执行命令时,我看到异常行为。当我跑步时
`find ./ -type f -exec sed -i -e 's/\/\/static.squarespace.com/http:\/\/static.squarespace.com/g' {} \;`
从终端,它可以工作,但是当我尝试在 Ruby 中使用
做同样的事情时`system(find ./ -type f -exec sed -i -e 's/\/\/static.squarespace.com/http:\/\/static.squarespace.com/g' {} \;)`
我明白了
find: -exec: no terminating ";" or "+"
我怎样才能在 Ruby 中成功地做到这一点?
【问题讨论】:
-
您似乎忘记在您的问题中添加一些
"s;因此,鉴于您拥有的代码不可执行,我们无法 100% 确定地找到问题。始终尽可能准确地复制粘贴您的问题。但很可能你需要加倍使用你的反斜杠。