[linux] Make checking for command existence more consistent and POSIX compatible
Merge pull request #5085 from veger/command-exists-posix

[linux] Make checking for command existence more consistent and POSIX compatible