Skip to content

Instantly share code, notes, and snippets.

@sillygwailo
Last active July 16, 2023 23:09
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sillygwailo/5468997 to your computer and use it in GitHub Desktop.
Save sillygwailo/5468997 to your computer and use it in GitHub Desktop.
Beer in my terminal prompt on Fridays
# The following code goes in your ~/.profile
#
# This propmpt shows a beer when you launch a Terminal window on a Fridays.
# It checks every time you get a new prompt. A minute after 11:59M on a
# Thursday, if you press enter, it will add beer to the prompt. A minute
# after 11:59 PM on a Friday, no more beer.
#
# This is for terminals that use the Bash shell, which was the default for
# MacOS previous to Catalina.
beer() {
if [[ $(date +%u) -eq 5 ]]
then
printf "🍺 " # two spaces at the end because printing emoji in Bash is weird
fi
}
export PS1="\h: \w \u$ $(beer)"
# The following code goes in your ~/.zshrc
#
# This propmpt shows a beer when you launch a Terminal window on a Fridays.
# It checks every time you get a new prompt. A minute after 11:59M on a
# Thursday, if you press enter, it will add beer to the prompt. A minute
# after 11:59 PM on a Friday, no more beer.
#
# As of MacOS Catalina, Zsh is the default shell for terminals. This uses
# the default prompt as found in /etc/zshrc as the basis for the prompt.
beer() {
if [[ $(date +%u) -eq 5 ]]
then
printf "🍺 "
fi
}
export PS1="%n@%m %1~ %# $(beer)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment