About grep

view story

http://www.unix.com – Dear all My boss recomended me to update my script code like this. Code: PIDFile=`cat pid` PIDMemory=`ps -ef | grep $PIDFile | grep -v grep` if [ $? = 0 ]; then   touch /apps/airserv/binaries/ESB/flag_lockfile         else         echo "Check the application......Starting process has failed!!!!!!!!!!!!!!!!!" but i really don't understand the last grep Where his use suggests two times, beside if we are filtering a process, why -v? this flag bring to me the other process that do not match!!! Any idea??? (HowTos)