Last active
July 16, 2023 23:09
-
-
Save sillygwailo/5468997 to your computer and use it in GitHub Desktop.
Beer in my terminal prompt on Fridays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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