-
Notifications
You must be signed in to change notification settings - Fork 3
/
.bash_prompt
87 lines (77 loc) · 1.81 KB
/
.bash_prompt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
if [ -f ~/.bashgit ]; then
. ~/.bashgit
fi
ENDCOLOR="\[\e[0m\]"
BLACK="\[\e[0;30m\]"
BLUE="\[\e[0;34m\]"
GREEN="\[\e[0;32m\]"
CYAN="\[\e[0;36m\]"
RED="\[\e[0;31m\]"
PURPLE="\[\e[0;35m\]"
BROWN="\[\e[0;33m\]"
GREY="\[\e[0;37m\]"
DGREY="\[\e[1;30m\]"
YELLOW="\[\e[1;33m\]"
WHITE="\[\e[1;37m\]"
B_BLUE="\[\e[1;34m\]"
B_GREEN="\[\e[1;32m\]"
B_CYAN="\[\e[1;36m\]"
B_RED="\[\e[1;31m\]"
B_PURPLE="\[\e[1;35m\]"
case $(id -u) in
0)
# STARTCOLOR='\[\e[31m\]';
STARTCOLOR=$B_RED;
;;
*)
# STARTCOLOR='\[\e[36m\]';
STARTCOLOR=$B_CYAN;
;;
esac
case $TERM in
xterm*)
TITLEBAR='\[\e]0;\u@\h \w \007\]';
;;
*)
TITLEBAR="";
;;
esac
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
curdir () {
echo $PWD | sed -e "s,$ZENHOME,ZENHOME,g" | sed -e "s,/Users/$USER/Archive/Projects/Zenoss/Zenoss/,,g"
}
curip () {
WIRED= ifconfig en0 | grep cast | awk '{print $2}'
WIRELESS= ifconfig en1 | grep cast | awk '{print $2}'
if [ -z $WIRED ]; then
$WIRELESS
else
$WIRED
fi
}
zend () {
local RESULT=""
local OUTPUT="`ps aux | grep $ZENHOME`"
local SEARCHFOR="(runzope|zopectl|Startup/run.py):Z
zenhub:h
zenjobs:j
|
(java.*zeneventserver):E
zeneventd:e
|
(java.*Impact):I
zenimpactstate:s
zenimpactgraph:i"
for f in $SEARCHFOR; do
if [ "$f" = "|" ]; then
RESULT="${RESULT}."
elif [ -n "`echo \"$OUTPUT\" | egrep \"${f%:*}\"`" ]; then
RESULT="${RESULT}${f#*:}"
fi
done
echo $RESULT
}
SEP=" $GREY| "
PS1="$STARTCOLOR\u$SEP$B_PURPLE$RED\$(curip)$SEP$GREEN\$(curdir)$YELLOW\$(__git_ps1)$GREY\n=\$>$ENDCOLOR "
export CSCOPE_DB=/Users/$USER/.tags/python/cscope.out