# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]]; then
	# Shell is non-interactive.  Be done now
	return
fi

# Shell is interactive.  It is okay to produce output at this point,
# though this example doesn't produce any.  Do setup for
# command-line interactivity.

# colors for ls, etc.  Prefer ~/.dir_colors #64489
if [[ -f ~/.dir_colors ]]; then
	eval `dircolors -b ~/.dir_colors`
elif [[ -f /etc/DIR_COLORS ]]; then
	eval `dircolors -b /etc/DIR_COLORS`
fi

# Change the window title of X terminals 
case $TERM in
	xterm*|rxvt*|Eterm)
		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
		;;
	screen)
		PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
		;;
esac

# uncomment the following to activate bash-completion:
#[ -f /etc/profile.d/bash-completion ] && source /etc/profile.d/bash-completion


setprompt(){
	host="$1"
	if [ -z "$host" ]; then
		host="$creset"
	fi

	if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]; then
		if [ `/usr/bin/whoami` = 'root' ]; then
			export PS1="${cbwhite}[\u@${host}\H${cbwhite}] ${cbred}\w \n${cbblue}$ $creset"
		else
			export PS1="${cbwhite}[\u@${host}\H${cbwhite}] ${cbgreen}\w \n${cbblue}$ $creset"
		fi
	fi
}


#nifty bash
shopt -s checkwinsize
shopt -s cdspell



[[ -f ~/.myshell/common ]] && \
source ~/.myshell/common

# $hostcolor should now be set
if [ -n "$hostcolor" ]; then
	hostcolor=$(eval "echo \$$(echo $hostcolor)")
fi
setprompt $hostcolor


[[ -f ~/.myshell/bash_local ]] && \
source ~/.myshell/bash_local

