Last active
April 29, 2024 22:52
-
-
Save brandon-wallace/7bb14c4e68235d748493c5da43036461 to your computer and use it in GitHub Desktop.
Bash Prompt Color Change On Execution
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
# Add this to your .bashrc file. | |
count=232; | |
# Set the prompt to change colors on execution of each command. | |
function bash_prompt(){ | |
PS1="\033[38;5;${count}m"' \W \$ '"\033[00m" | |
count=$((count+1)); | |
[ $count -eq 255 ] && count=232; | |
} | |
PROMPT_COMMAND=bash_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment