Refactor prompt_cmd() into prompt() to avoid eval

The prompt must be displayed on stderr, or else it will become part of the result,
since stdout is used to pass the result back to the caller of _prompt().