Skip to content

Instantly share code, notes, and snippets.

@perfecto25
Last active December 5, 2018 17:55
Show Gist options
  • Save perfecto25/be703cb1f28c32ea0c3f08d792e9b259 to your computer and use it in GitHub Desktop.
Save perfecto25/be703cb1f28c32ea0c3f08d792e9b259 to your computer and use it in GitHub Desktop.
.bashrc PS1 settings
#!/bin/bash
# Colorize your terminal according to hostname - helps avoid typing wrong commands into PROD!!
termcolorenv() {
HOST=$(echo "${1}" | cut -d'@' -f2)
case $HOST in
qbt* ) PROFILE="PROD" ;;
atlas* ) PROFILE="PROD" ;;
qbch* ) PROFILE="PROD";;
awstestbox ) PROFILE="DEV" ;;
# ... if you have more cases ...
*) PROFILE="ToyChest" ;;
esac
terminator -p $PROFILE -x bash -c "ssh $1" &
#gnome-terminal --window-with-profile=$PROFILE -x bash -c "ssh $1";
}
#alias ssh=sshhelper # this will "override" the ssh command, but may break other stuff!
alias ssh=termcolorenv
alias ll="ls -lha"
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\] \$(git_branch)\[\033[00m\]\$ "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment