Sometimes we need a visual hint to indicate the return status of previous command. The following snippet make put it at the head of the PS1.

Note that the __stat() function should be called every time a new PS1 is generated, or else it would stick to the return status of last command of your .bashrc or .bash_profile.

# -ANSI-COLOR-CODES- #
Color_Off="\\033[0m"
###-Regular-###
Red="\\033[0;31m"
Green="\\033[0;32m"
Yellow="\\033[0;33m"
####-Bold-####

function __stat() {
    if [ $? -eq 0 ]; then
        echo -en "$Green ✔ $Color_Off "
    else
        echo -en "$Red ✘ $Color_Off "
    fi
}

PS1='$(__stat)'
PS1+="[\\t] "
PS1+="\\e[0;33m\\u@\\h\\e[0m:\\e[1;34m\\w\\e[0m \\n$ "

export PS1

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/60d88936-e169-4337-9c85-fc96142a969d/Untitled.png