¿Cómo funciona ps aux | grep '[p] attern' excluye a grep?
El título lo dice todo. He visto este lenguaje utilizado mucho en lugar de agregar un adicionalgrep -v grep
en algunosps
tubería. Por ejemplo, podría ser usado así:
$ ps aux | grep '[f]irefox' | awk '{ print $8 }'
en lugar de
$ ps aux | grep 'firefox' | grep -v grep | awk '{ print $8 }'
Es muy conveniente, pero ¿cómo funciona y por qué?