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?
精彩评论