6

How can I pass strings with single quotes to grep?

view full story
linux-howto

http://unix.stackexchange.com – My desired outcome is the following: to recursively search a directory looking for a given string in all found files. The following command is my usual port of call: find ./ | xargs grep -ns 'foobar' However, when foobar has quotes the command fails and gives me a > prompt in the shell. The specific command that's causing the problem is as follows: find ./ | xargs grep -ns 'add_action(\'save_post\',' I've tried to escape the quotes with backslashes but to no avail. What's the correct way to do this? (HowTos)