Johann Spies <[EMAIL PROTECTED]> writes: > In the grep's info page I find the following which works as said. > But I want to know why. What does the [c] do in this case? > > ------------------------ > 7. Why do people use strange regular expressions on `ps' output? > > ps -ef | grep '[c]ron' > > If the pattern had been written without the square brackets, it > would have matched not only the `ps' output line for `cron', > but also the `ps' output line for `grep'.
Because both 'cron' and 'grep cron' match the pattern 'cron'. '[c]ron' also matches the word 'cron' (it's an equivalent regular expression), but it doesn't match 'grep [c]ron'. -- David Maze [EMAIL PROTECTED] http://people.debian.org/~dmaze/ "Theoretical politics is interesting. Politicking should be illegal." -- Abra Mitchell -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]