Categories
Linux Mastering Development

how to run `find -exec` inside bash function — problem escaping characters and unexpected end of file

I want to make it easier to run this kind of command:

find . -type f -exec sed -i 's|wpp-splash|wpp_splash|g' {} \;

so I created a function in my .bashrc to shorten it:

function sedall() { find . -type f -exec sed -i 's|$1|g' {} \; }

this way I can do

sedall wpp-splash|wpp_splash

But there is a syntax error. I am not sure what it is, but that bash function is resulting in "unexpected end of file". I wonder if it is something with the } characters? I tried escaping them like \{\} but that did not solve the problem.

Any help, please?

Leave a Reply

Your email address will not be published. Required fields are marked *