Skip to content

Instantly share code, notes, and snippets.

@hgoldstein95
Created November 27, 2015 04:12
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 hgoldstein95/40805958f58103be72ff to your computer and use it in GitHub Desktop.
Save hgoldstein95/40805958f58103be72ff to your computer and use it in GitHub Desktop.
Bash Profile Script
## Defaults ##
case $- in
*i*) ;;
*) return;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s checkwinsize
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
alias ll='ls -lF'
alias la='ls -A'
alias l='ls -CF'
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
## END Defaults ##
## Personal Aliases ##
alias cls=clear
alias ga='atom .&gulp'
# VM Stuff
alias startvm='VBoxManage startvm CS3410'
alias mountvm='sudo sshfs -o allow_other hjg42@127.0.0.1:/home/hjg42 /mnt/CS3410 -p 3410'
alias unmountvm='sudo umount /mnt/CS3410'
alias sshvm='ssh hjg42@localhost -p 3410'
## Exports ##
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
# added by Anaconda 2.3.0 installer
export PATH="/home/harry/Packages/anaconda/bin:$PATH"
# Phonegap
export ANDROID_HOME=/usr/android-sdk-linux
## Prompt ##
COLOR_RED="\033[0;31m"
COLOR_YELLOW="\033[0;33m"
COLOR_GREEN="\033[0;32m"
COLOR_OCHRE="\033[38;5;95m"
COLOR_BLUE="\033[0;34m"
COLOR_WHITE="\033[0;37m"
COLOR_RESET="\033[0m"
function git_color {
local git_status="$(git status 2> /dev/null)"
if [[ ! $git_status =~ "working directory clean" ]]; then
echo -e $COLOR_RED
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
echo -e $COLOR_YELLOW
elif [[ $git_status =~ "nothing to commit" ]]; then
echo -e $COLOR_GREEN
else
echo -e $COLOR_OCHRE
fi
}
function git_branch {
local git_status="$(git status 2> /dev/null)"
local on_branch="On branch ([^${IFS}]*)"
local on_commit="HEAD detached at ([^${IFS}]*)"
if [[ $git_status =~ $on_branch ]]; then
local branch=${BASH_REMATCH[1]}
echo "($branch)"
elif [[ $git_status =~ $on_commit ]]; then
local commit=${BASH_REMATCH[1]}
echo "($commit)"
fi
}
PS1="\033[38;5;214m"
PS1+="\u"
PS1+="\[$(tput sgr0)\]"
PS1+="\033[38;5;255m"
PS1+="@"
PS1+="\[$(tput sgr0)\]"
PS1+="\033[38;5;119m"
PS1+="\h"
PS1+="\[$(tput sgr0)\]"
PS1+="\033[38;5;255m"
PS1+=" : "
PS1+="\[$(tput sgr0)\]"
PS1+="\033[38;5;045m"
PS1+="\w "
PS1+="\[\$(git_color)\]"
PS1+="\$(git_branch)"
PS1+="\[$(tput sgr0)\]"
PS1+="\033[38;5;255m"
PS1+=" \n"
PS1+="\\$ \[$(tput sgr0)\]"
export PS1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment