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
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
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?