Hacker News new | ask | show | jobs
by smcdow 5540 days ago

  function psg () { [[ -z "$1" ]] && return ; local _first=${1:0:1} ; local _rest=${1:1} ; [[ -z "$_rest" ]] && _rest='[^]]' ; local _com="ps -ef | grep '[$_first]'$_rest" ; eval "$_com" }
2 comments

Wow, that's certainly one way to do it. I'm still not seeing an issue with 'grep -v grep'.

  ps -ef | grep foo | grep -v grep
Will fail if foo="grep"
Drop it in your .bashrc and just type "psg foo"