Bash – Using watch with pipes

bashgreptailwatch

I'd like to run this command:

watch -n 1 tail -n 200 log/site_dev.log | grep Doctrine

But it does not run, because "I think" that the grep tries to run on the watch instead of the tail…

Is there a way to do something like

watch -n 1 (tail -n 200 log/site_dev.log | grep Doctrine)

Thanks a lot!

Best Answer

Surround the command with quotes

watch -n 1 'tail -n 200 log/site_dev.log | fgrep Doctrine'