Permalink
Browse files

only show user/host for not my machine.

thanks @sindresorhus for mocking me every step of the way. :p
  • Loading branch information...
1 parent e27e34b commit 4cbdac7b7ea4b502bece9d98a6ac40a5b5df6f55 @paulirish committed Sep 23, 2012
Showing with 10 additions and 1 deletion.
  1. +10 −1 .bash_prompt
View
@@ -1,6 +1,10 @@
# @gf3’s Sexy Bash Prompt, inspired by “Extravagant Zsh Prompt”
# Shamelessly copied from https://github.com/gf3/dotfiles
+default_username='paulirish'
@paulirish
paulirish Sep 23, 2012 Owner

yourmom.
🙎

@sindresorhus
sindresorhus Sep 23, 2012

Either implement the suggested changes below or I will do it forcefully on your behalf.

+
+
+
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM=gnome-256color
elif infocmp xterm-256color >/dev/null 2>&1; then
@@ -43,6 +47,11 @@ function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
+# Only show username/host if not default
+function usernamehost() {
+ if [ $USER != $default_username ]; then echo "${MAGENTA}$USER ${WHITE}at ${ORANGE}$HOSTNAME $WHITEin "; fi
@sindresorhus
sindresorhus Sep 23, 2012

@paulirish Could be:

[ $USER != $default_username ] && echo "${MAGENTA}$USER ${WHITE}at ${ORANGE}$HOSTNAME $WHITEin "

Just saying :p

+}
+
# iTerm Tab and Title Customization and prompt customization
# http://sage.ucsc.edu/xtal/iterm_tab_customization.html
@@ -54,4 +63,4 @@ function parse_git_branch() {
# in the iterm tab
# \[\e]1;\]$(basename $(dirname $PWD))/\W\[\a\]
-PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]$(basename "$(dirname "$PWD")")/\W\[\a\]\[${BOLD}${MAGENTA}\]\u \[$WHITE\]at \[$ORANGE\]\h \[$WHITE\]in \[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
+PS1="\[\e]2;$PWD\[\a\]\[\e]1;\]$(basename "$(dirname "$PWD")")/\W\[\a\]${BOLD}\$(usernamehost)\[$GREEN\]\w\[$WHITE\]\$([[ -n \$(git branch 2> /dev/null) ]] && echo \" on \")\[$PURPLE\]\$(parse_git_branch)\[$WHITE\]\n\$ \[$RESET\]"
@sindresorhus
sindresorhus Sep 23, 2012

Too much escaping, getting nauseated.

0 comments on commit 4cbdac7

Please sign in to comment.