Display emoji faces for correct & wrong commands in terminals I want to customize my terminal to display emoji faces, showing sad face for wrong command and happy face for right command that I enter. Is there any way that I can do this using my terminal bash.

Here is my PS1 from .bash_profile

export PS1="[\[\e[1;32m\]\@\[\e[m\]] [\[\e[1;34m\]\u\[\e[m\]➡ \[\e[1;31m\]\W\[\e[m\]]\$ "
Building on Maghin's post. 

# Use echo -n to leave out the line end.
# Use -C option with hexdump to avoid big endian/little 
# endian confusion.
mac $  echo -n  | hexdump -C
00000000  f0 9f 98 80                                       |....|
00000004
mac $  echo -n   | hexdump -C
00000000  f0 9f 98 b1                                       |....|
00000004


"Include non-0 exit codes in the subsequent bash prompt"
http://stackoverflow.com/questions/5946873/include-non-0-exit-codes-in-the-subsequent-bash-prompt

Here is what I ended up with:

export PS1='\u $(highlightExitCode) \$ '


highlightExitCode()
    {
        exit_code=$?
        if [ $exit_code -ne 0 ]
        then
           echo -en '\xf0\x9f\x98\xb1 '
        else
           echo -en '\xf0\x9f\x98\x80 '
        fi

    }




A more straight forward alternative for the highlightExitCode function:

 highlightExitCode ()  { 
   if [ $? -ne 0 ]; then
     echo -n ' ';
   else
     echo -n ' ';
   fi 
 }


The only problem is that the bad image appears until to you run a succesful command.