-
-
Save rjungemann/9d26ef4ffadb4590e2cc86eca3c4323f to your computer and use it in GitHub Desktop.
Host-dependent automatic prompt colorization
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
# Set the gaudy prompt. | |
# ^O puts terminal back into default text mode for every prompt, | |
# preventing random glyphs. | |
resetterm="\[\017\]" | |
# \[ and \] prevent the shell from counting these characters | |
# against the line length. | |
usercolor="\[\033[35m\]" # purple | |
hostcolor="\[\033[4"$(( ( $(hostname|cksum|cut -d\ -f1|cut -d\ -f1) / 7 ) % 7))"m\033[1;3"$(( $(hostname|cksum|cut -d\ -f1|cut -d\ -f1) % 7))"m\]" # bold-random-color on random-color | |
timecolor="\[\033[35m\]" # purple | |
normcolor="\[\033[0m\]" # prompt bg | |
resetcolor="\[\033[0m\]" # terminal default | |
# To put in xterm titlebar, \007 ends string but \r backs over it | |
# for non-parsing terminals. Have to change this for non-parsing | |
# terminals so that they won't beep at me for every line. | |
title="\[\033]0;b:\w\007\r\]" | |
export PS1=$resetterm""$title""$normcolor"["$usercolor"\u"$normcolor"@"$hostcolor"\h"$normcolor":"$timecolor"\A"$normcolor" \j \w]\$"$resetcolor" " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment