grep -i: case insensitive
cmd-doesnt-respect-difference-between-stdout-and-stderr |& grep -i SomeError|& 相当于 2>&1 |,使 stderr 也重定向到 stdout 而不向终端输出。 参见 pipeline 原理。
grep -o, --only-matching show only nonempty parts of lines that match
grep -P, --perl-regexp PATTERNS are Perl regular expressions
-grep E --extended-regexp Interpret PATTERNS as Perl-compatible regular expressions (PCREs).
grep 的 -o 选项可以只显示匹配的 pattern,而 pattern 又是一个正则表达式,所以我们只需在待匹配字符的前后加上若干数量的通配符即可。比如我想显示 “write” 周围前后 10 个字符(如果存在的话),那 pattern 应写作 "grep -o .\{0,10\}write.\{0,10\}" grep -o -P".{0,10}write.{0,10}"
- removing the job from the job table or telling the shell to not send SIGHUP on session end (by using disown in either case)
- telling the child process to ignore SIGHUP (by using nohup)