How to remove the return code from the terminal prompt
In addition to the PS1 environment variable, the PROMPT_COMMAND environment variable also affects your prompt. From the bash man page:
If set, the value is executed as a command prior to issuing each primary prompt
It is that command that is adding the unwanted content to your prompt. You can stop that behavior by unsetting the variable in your .bashrc:
unset PROMPT_COMMAND
具体做法为:
vi ~/.bashrc
在下面加入unset PROMPT_COMMAND,如图:

浙公网安备 33010602011771号