dotfiles/bash/bashrc.common

39 lines
1.1 KiB
Plaintext

# Add path function: check if path exists in $PATH, only then prepend the
# specified path to PATH
add_to_path() {
if [[ ! -z $1 && -d $1 && ":$PATH:" != *":$1:"* ]]; then
export PATH=$1:$PATH
fi
}
# Define the colors used by the prompt
T_B=$(tput setaf 4) # Blue
T_G=$(tput setaf 2) # Green
T_Y=$(tput setaf 3) # Yellow
T_S=$(tput sgr0) # Reset
# Import the Git prompt shell functions. These can be found
# @github:git/git/contrib/completion/git_prompt.sh
if [ -f $HOME/.git_prompt.sh ]; then
source $HOME/.git_prompt.sh
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)$(__git_ps1 " \[$T_Y\](%s)")\[$T_S\]]\$ '
else
export PS1='\[$T_B\]\u@\h \[$T_S\][\[$T_G\]$(smartwd)\[$T_S\]]\$ '
fi
# Add $HOME/bin to PATH
add_to_path $HOME/bin
# Add ls coloring
# Don't bother if LS_COLORS is already set
if [[ -z $LS_COLORS && -f $HOME/.bashrc.lscolors ]]; then
source $HOME/.bashrc.lscolors
fi
# Keep system specific aliases in a seperate file called .aliases
# If .aliases exists it will envoked by the next line:
if [ -f $HOME/.aliases ]; then
source $HOME/.aliases
fi