Created
December 18, 2024 11:22
-
-
Save tomnomnom/a86f5d215cf8c83c26c5f7a58cc697ae to your computer and use it in GitHub Desktop.
Print a grey timestamp before running bash commands
This file contains hidden or 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
PROMPT_COMMAND='PS1_RUN_PREEXEC=1' | |
preexec() { | |
if [ -z "$PS1_RUN_PREEXEC" ]; then | |
return | |
fi | |
unset PS1_RUN_PREEXEC | |
echo $'\e[38;5;241m'"[$(date +'%Y-%m-%dT%H:%M:%S%z')]"$'\e[0m' | |
} | |
trap 'preexec' DEBUG |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment