Unix commandline

Just a few scripts useful for changing many files at once.

To replace all double quoted strings with single quoted strings in ruby to make rubocop happy:

find . -type f -iname '*.rb' -exec sed -i.bak "s/\"/'/" "{}" +;

Now find all the places where you do string interpolation and make them back to double quoted strings.

Then to remove all .bak files when you are sure you got it right"

find . -name "*.bak" -exec rm -rf {} \;

Image courtesy of Travis Isaacs

comments powered by Disqus