#!/bin/bash# Colorized pgrep arg1="$1" if [[ $arg1 = *"grep"* ]];then # remote the grep command itself from process list! ps -eo pid,ppid,uname:20,cmd | grep -v $$ | grep --color=auto "$arg1"else ps -eo pid,ppid,uname:20,cmd | grep -v 'grep' | grep --color=auto "$arg1"fi
#!/bin/bash
# Colorized pgrep
arg1="$1"
if [[ $arg1 = *"grep"* ]];then
# remote the grep command itself from process list!
ps -eo pid,ppid,uname:20,cmd | grep -v $$ | grep --color=auto "$arg1"
else
ps -eo pid,ppid,uname:20,cmd | grep -v 'grep' | grep --color=auto "$arg1"
fi