Created
January 2, 2022 19:24
-
-
Save hleroy/31c669564020932dd53ff66d7c7bca1b to your computer and use it in GitHub Desktop.
Display reminders when cd-ing into directories containing a .cd-reminder file
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
# cd_reminder | |
# - Add bash excerpt below to your .bashrc or .bash_aliases | |
# - Restart your terminal or run `source .bashrc` | |
# - Add a file named `.cd-reminder` into a directory | |
# - `cd` into this directory: the content of `.cd-reminder` will be printed out | |
# Slightly modified version from https://unix.stackexchange.com/questions/18532/show-message-when-cd-into-specific-directory | |
# to allow printing ANSI colors | |
cd_reminder() { | |
builtin cd "$@" && { [ ! -f .cd-reminder ] || echo -ne $(cat .cd-reminder | sed 's/$/\\n/' | sed 's/ /\\a /g'); } | |
} | |
alias cd=cd_reminder |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment