diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..5af90aa --- /dev/null +++ b/.bashrc @@ -0,0 +1,48 @@ +# .bashrc + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +alias ls='ls --color=auto' +#PS1='[\u@\h \W]\$ ' + +__git_ps1 () +{ + local b="$(git symbolic-ref HEAD 2>/dev/null)"; + if [ -n "$b" ]; then + printf " (%s)" "${b##refs/heads/}"; + fi +} +export PS1='\ +\[\e[01;30m\]\t \ +`[ "$(screen -ls | grep -c Detach)" != "0" ]\ +&& echo "\[\e[00;34m\]$(screen -ls | grep -c Detach ) "`\ +`[ "$(jobs -r | wc -l)" != "0" ]\ +&& echo "\[\e[00;33m\]$(jobs -r | wc -l ) "`\ +`[ "$(jobs -s | wc -l)" != "0" ]\ +&& echo "\[\e[00;31m\]$(jobs -s | wc -l ) "`\ +\[\e[01;37m\][\ +`[ $UID == 0 -a $USER != $(logname) ]\ +&& echo "\[\e[00;31m\]"`\ +`[ $UID == 0 -a $USER != $(logname) -a -z "$SUDO_USER" ]\ +&& echo "\[\e[01;31m\]"`\ +`[ $UID == 0 -a $USER == $(logname) ]\ +&& echo "\[\e[01;33m\]"`\ +`[ $UID != 0 -a $USER == $(logname) ]\ +&& echo "\[\e[00;32m\]"`\ +`[ $UID != 0 -a $USER != $(logname) ]\ +&& echo "\[\e[00;33m\]"`\ +\u\ +\[\e[00;36m\]@\ +`[ "$SSH_CLIENT" != "" -o "$SSH2_CLIENT" != "" ]\ +&& echo "\[\e[00;33m\]"\ +|| echo "\[\e[00;32m\]"`\ +\h \ +`[ -w "${PWD}" ]\ +&& echo "\[\e[01;34m\]\W"\ +|| echo "\[\e[01;31m\]\W"`\ +\[\e[01;37m\]]\ +`[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working +directory clean" ]]\ +&& echo "\[\e[01;31m\]"\ +|| echo "\[\e[01;32m\]"`$(__git_ps1 "(%s)")\[\e[00m\]\$ '