Skip to content

Instantly share code, notes, and snippets.

@kylog
Created July 9, 2013 17:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylog/5959294 to your computer and use it in GitHub Desktop.
Save kylog/5959294 to your computer and use it in GitHub Desktop.
This is part of .bash_kylo. The prompt stuff is WIP and there's some old code. The Darwin line is the most recently hacked on prompt. And note the sshk function which I use to carry the .bash_kylo file forward to move the prompt (and other stuff) to new hosts. All kinda hacky but works for now.
# Fun with prompts
# Ideas:
# http://www.maketecheasier.com/8-useful-and-interesting-bash-prompts/2009/09/04
# http://www.termsys.demon.co.uk/vtansi.htm
# http://slashdot.org/comments.pl?sid=108424&cid=9219400
#
RESET="\[\017\]"
NORMAL="\[\e[0m\]"
BRIRED="\[\e[1;31m\]"
BRIGRN="\[\e[1;32m\]"
BRIYEL="\[\e[1;33m\]"
BRIBLU="\[\e[1;34m\]"
BRIMAG="\[\e[1;35m\]"
BRICYA="\[\e[1;36m\]"
BRIWHI="\[\e[1;37m\]"
DIMRED="\[\e[2;31m\]"
DIMGRN="\[\e[2;32m\]"
DIMYEL="\[\e[2;33m\]"
DIMBLU="\[\e[2;34m\]"
DIMMAG="\[\e[2;35m\]"
DIMCYA="\[\e[2;36m\]"
DIMWHI="\[\e[2;37m\]"
PS1='\u@\h:\D{%d%H%M}:\w> '
case "$TERM" in
xterm)
type ppwd >/dev/null 2>&1 || alias ppwd=pwd;
# Moving the ball forward on OSX, push back to Linux at some point ...
case "`uname`" in
Darwin)
PS1="\`if [[ \$? = "0" ]]; then echo "\\[\\e[32m\\]"; else echo "\\[\\e[31m\\]"; fi\`[\!] ${DIMCYA}\u@\h ${DIMYEL}\D{%d%H%M}:${BRIYEL}\W${BRIWHI}>\[\e[m\] ";;
Linux)
PS1="\`if [[ \$? = "0" ]]; then echo "\\[\\e[32m\\]"; else echo "\\[\\e[31m\\]"; fi\`[\!] ${DIMCYA}\u@\h ${DIMYEL}\D{%d%H%M}:${BRIYEL}\W${BRIWHI}>\[\e[m\] ";;
#PS1='\[\e]2;\h:$(ppwd)\007\e]1;\h\007\e[1;31m\]\u@\h:\[\e[0;33m\]\D{%d%H%M}:\[\e[1;33m\]\w\[\e[1;37m\]>\[\e[m\] ';;
esac ;;
linux)
PS1='\[\e[1;31m\]\u@\h:\[\e[0;33m\]\D{%d%H%M}:\[\e[1;33m\]\w\[\e[1;37m\]>\[\e[m\] ';;
emacs)
PS1='> ';;
esac
sshk () {
scp ~/.bash_kylo ${1}: > /dev/null
ssh $1 -t "bash --rcfile ~/.bash_kylo -i"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment