[bash] Check for the existence of commands in a more portable way.