19

I've seen several instances where people are doing this:

grep [f]oobar

But I don't understand why that is preferable to

grep foobar
hortitude
  • 565

1 Answers1

33

There's no reason that's preferable syntax on its own. It's sometimes used as a hack when "grepping" for a process (e.g., ps aux | grep [a]pache). Using that syntax prevents grep from matching its own command line in the process list.

See How to prevent "ps" reporting its own process?

Jeff Ferland
  • 20,987