RED="\[\033[31;1m\]"
NORMAL="\[\033[0m\]"
PS1_INSIDE='${debian_chroot:+($debian_chroot)}\u@\h:\w$bad\$ '
PS1="\`
retcode=\$? ;
if [ 0 -ne \$retcode ]; then
bad=\" [\\\\\\\$?=\$retcode]\"
echo \"$RED$PS1_INSIDE$NORMAL\"
else
bad='';
echo \"$PS1_INSIDE\";
fi;
\`"
unset RED NORMAL PS1_INSIDE