Skip to content

Instantly share code, notes, and snippets.

@mhamilt
Last active May 29, 2020 10:51
Show Gist options
  • Save mhamilt/9f103200b7205c00d27a4af62e9040ed to your computer and use it in GitHub Desktop.
Save mhamilt/9f103200b7205c00d27a4af62e9040ed to your computer and use it in GitHub Desktop.
Random changing emoji prompt in bash
# declares an array with the emojis we want to support
EMOJIS=("🐑" "🦔" "🐈" "🦆" "🐓")
# function that selects and return a random element from the EMOJIS set
RANDOM_EMOJI() {
SELECTED_EMOJI=${EMOJIS[$RANDOM % ${#EMOJIS[@]}]};
echo $SELECTED_EMOJI;
}
# declare the terminal prompt format
export PS1='$(RANDOM_EMOJI) '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment