Why use ps -ef check the process every time the pid will change?
Every time you run this in Terminal two new processes for ps and grep are created, run to do their job and then terminated successfully. So each invocation gets new PIDs. 



To properly exclude the process grep search_string from grep'ing for search_string in the ps result use:

ps -ef | grep -v grep | grep search_string


or

ps -ef | grep [s]earch_string


e.g. ps -ef | grep -v grep | grep safira or ps -ef | grep [s]afira