Why does pidof from homebrew returns always zero? I've installed pidof via homebrew

brew install pidof


And think about two cases:

$ pidof bash &gt; /dev/null; echo $?
$ pidof asdf &gt; /dev/null; echo $?


The results are:

0
0


Why does it happen? Other linux throw 1 when pidof couldn't find process.
If you look at the Homebrew formula of pidof, you will see that the Homebrew version is built from : http://www.nightproductions.net/downloads/pidof_source.tar.gz

If you look at the source code pidof.c used by Homebrew, you will see that each occurrence of the return statement in the main function, is in the form:

return 0


except one time, when the usage of the command is printed:

printf("USAGE: %s [-klvh] [PID name]\n",ProgName);
                return 1;
                break;


On the other hand, in Linux distributions, such as Debian, the pidof command is coming  from the System V style init programs. If you download the source code and look at killall5.c (which is then linked to pidof), you have at the last line of the main function:

return retval;


where retvalcan be non-null.

So the main reson why the Homebrew version of pidof and the Linux version of pidof return different values is because they use different codebase.