Skip to content

Instantly share code, notes, and snippets.

@laanwj
Created February 22, 2017 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laanwj/3c8c116fc763a149842a07070ca4d6cd to your computer and use it in GitHub Desktop.
Save laanwj/3c8c116fc763a149842a07070ca4d6cd to your computer and use it in GitHub Desktop.
Generate debian/ubuntu prompt with random xterm256 colors
# Try colors for Ubuntu prompt
# . prompt_test.sh 123 125
if [ ! -z "$1" ] && [ ! -z "$2" ]; then
COLOR1=$1
COLOR2=$2
else
COLOR1=$((($RANDOM%240)+16))
COLOR2=$((($RANDOM%240)+16))
echo "Choosing random colors ${COLOR1} and ${COLOR2}"
fi
PS1='${debian_chroot:+($debian_chroot)}\[\033[38;5;${COLOR1}m\]\u@\h\[\033[00m\]:\[\033[38;5;${COLOR2}m\]\w\[\033[00m\]\$ '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment