开发者

shell command (involving sed) works in bash but not in rake task on mac os

I have a rake task th开发者_运维百科at performs a shell command. When I run it from bash, the substitution worked, but when I run the rake task, the substitution did not take place.

My rake file:

require 'rake'
namespace 'performance_tests' do
  task :test_guests_generation do

    %x{sed -e 's/NO_OF_GUESTS = \[.*]/NO_OF_GUESTS = \[400, 10]/' -i '' db/seeds.rb}
  end
end

Trying the command in Mac OS Terminal does perform the substitution:

$ sed -e 's/NO_OF_GUESTS = \[.*]/NO_OF_GUESTS = \[400, 10]/' -i '' db/seeds.rb


Um... not sure to be honest. Have you tried escaping the spaces? Can you paste the line you are working on and the desired result?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜