Modify PROMPT_COMMAND such that sudo does not complain.

Check that the functions which are being called in PROMPT_COMMAND
actually exist before calling them. This way launching `sudo su` does
not complain about missing functions.