Skip to content

Instantly share code, notes, and snippets.

@hunterhector
Last active September 16, 2020 17:50
Show Gist options
  • Save hunterhector/e8befc2d0bfe636bee56 to your computer and use it in GitHub Desktop.
Save hunterhector/e8befc2d0bfe636bee56 to your computer and use it in GitHub Desktop.
Add Emoticons to terminal
# Save each emoticon in a line at the EMOFILE location below
# I use this gist : https://gist.github.com/hunterhector/7458898
# Add the following to your .bash_profile to get random emoticons in your bash prompt.
# This works for Mac, change gsort to sort on general Linux distributions.
# Config Emoticon for PS1
export EMOFILE=~/.dotfiles/emoticons
export UCOLOR="\[\033[1;34m\]"
export WCOLOR="\[\033[1;39m\]"
export EMOCOLOR="\[\033[1;35m\]"
export TEXTCOLOR="\[\033[1;32m\]"
export COLOREND="\[\033[0m\]"
alias chEmo='EMOTICON=`cat $EMOFILE | gsort -R | head -n 1` && export PS1="$UCOLOR\u$COLOREND$EMOCOLOR$EMOTICON$COLOREND$WCOLOR \W$COLOREND$TEXTCOLOR:$ $COLOREND"'
# change emoticon everytime you source the bashe_profile, or you can call this command if you don't like the current one.
chEmo
# Some character in the emoticons may screw up your bash, I uses the delEmo alias below to get rid of them
# Use the delEmo alias if you maintain your own gist, you also need the gist command line tool for this to work.
# alias delEmo='cp $EMOFILE /tmp/emoticons.bk && grep -v "^$EMOTICON$" /tmp/emoticons.bk > $EMOFILE && chEmo && gist $EMOFILE -u 7458898'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment