-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdot_bash_prompt
78 lines (72 loc) · 1.69 KB
/
dot_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
#!/bin/bash
Reset='\e[0m' # Reset all formatting
# Foreground (text)
DefaultFg='\e[39m'
Black='\e[30m'
Red='\e[31m'
Green='\e[32m'
Yellow='\e[33m'
Blue='\e[34m'
Magenta='\e[35m'
Cyan='\e[36m'
LightGray='\e[37m'
DarkGray='\e[90m'
LightRed='\e[91m'
LightGreen='\e[92m'
LightYellow='\e[93m'
LightBlue='\e[94m'
LightMagenta='\e[95m'
LightCyan='\e[96m'
White='\e[97m'
Bold='\e[1m'
NoBold='\e[21m'
Dim='\e[2m'
NoDim='\e[22m'
Under='\e[4m'
NoUnder='\e[24m'
Blink='\e[5m' # Doesn't work on most terminal emulators
NoBlink='\e[25m'
Invert='\e[7m'
NoInvert='\e[27m'
Hidden='\e[8m'
NoHidden='\e[27m'
# Background
DefaultBg='\e[39m'
BlackBg='\e[40m'
RedBg='\e[41m'
GreenBg='\e[42m'
YellowBg='\e[43m'
BlueBg='\e[44m'
PurpleBg='\e[45m'
CyanBg='\e[46m'
LightGrayBg='\e[47m'
DarkGrayBg='\e[100m'
LightRedBg='\e[101m'
LightGreenBg='\e[102m'
LightYellowBg='\e[103m'
LightBlueBg='\e[104m'
LightPurpleBg='\e[105m'
LightCyanBg='\e[106m'
WhiteBg='\e[107m'
function purty_prompt {
if [[ $USER == "root" ]]
then
local USER_COLOR="\\[$Bold\\]\\[$Red\\]"
local USER_PROMPT="\\[$Bold\\]\\[$Red\\]\\$\\[$DefaultFg\\]\\[$NoBold\\]"
else
local USER_COLOR="$Yellow"
local USER_PROMPT="\$(if [ \$? = 0 ]; then echo '\\[$Green\\]\$\\[$DefaultFg\\]'; else echo '\\[$Red\\]\$\\[$DefaultFg\\]'; fi)"
fi
PS1="\[\e]0;\u@\h: \w\007\]\[$Reset\]\
\[$LightGray\]\
[\[$USER_COLOR\]\u\[$Reset\]\[$LightGray\]@\[$Magenta\]\h\[$LightGray\]]\
\e(0q\e(B\[$LightGray\]\
[\[$Reset\]\!\[$LightGray\]]\
\e(0q\e(B\[$LightGray\]\
[\[$Reset\]\D{%H:%M}\[$LightGray\]]\
\e(0q\e(B\e(0q\e(B\
[\[$Blue\]\w\[$LightGray\]]\[$Reset\]\n\
\[$LightGray\]${USER_PROMPT}\[$Reset\] "
}
purty_prompt
unset purty_prompt