File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -26,3 +26,7 @@ PROMPT_COMMAND="__prompt $color_prompt yes"
26
26
```
27
27
28
28
![ With the hostname] ( screen2.png )
29
+
30
+ When the user is root:
31
+
32
+ ![ When root] ( screen3.png )
Original file line number Diff line number Diff line change @@ -12,6 +12,15 @@ function __prompt() {
12
12
local -r C_BOLD_GREEN=' \[\e[01;32m\]'
13
13
local -r C_BOLD_YELLOW=' \[\e[01;33m\]'
14
14
local -r C_BOLD_PURPLE=' \[\e[01;35m\]'
15
+ local -r C_BOLD_CYAN=' \[\e[01;36m\]'
16
+
17
+ if [ " $UID " = 0 ]; then
18
+ local -r C_USER=$C_RED
19
+ local -r C_HOST=$C_BOLD_CYAN
20
+ else
21
+ local -r C_USER=$C_CYAN
22
+ local -r C_HOST=$C_BOLD_GREEN
23
+ fi
15
24
16
25
local git_prompt=' '
17
26
if git rev-parse --git-dir > /dev/null 2>&1 ; then
@@ -41,14 +50,14 @@ function __prompt() {
41
50
local host=' '
42
51
if [ " $show_host " = yes ]; then
43
52
if [ " $use_color " = yes ]; then
44
- host=" ${C_YELLOW} @${C_BOLD_RED} <${C_BOLD_GREEN } \h${C_BOLD_RED} >${C_NONE} "
53
+ host=" ${C_YELLOW} @${C_BOLD_RED} <${C_HOST } \h${C_BOLD_RED} >${C_NONE} "
45
54
else
46
55
host=' @!\h!'
47
56
fi
48
57
fi
49
58
50
59
if [ " $use_color " = yes ]; then
51
- PS1=" ╭─${C_WHITE} \t${C_NONE} \$ {debian_chroot:+(\$ debian_chroot)}${C_CYAN } \u${C_NONE}${host} : ${C_BOLD_YELLOW} \w${C_NONE}${git_prompt} \n╰─${C_BOLD_PURPLE} \$ ${C_NONE} "
60
+ PS1=" ╭─${C_WHITE} \t${C_NONE} \$ {debian_chroot:+(\$ debian_chroot)}${C_USER } \u${C_NONE}${host} : ${C_BOLD_YELLOW} \w${C_NONE}${git_prompt} \n╰─${C_BOLD_PURPLE} \$ ${C_NONE} "
52
61
else
53
62
PS1=" ╭─\t \$ {debian_chroot:+(\$ debian_chroot)}\u${host} : \w${git_prompt} \n╰─\$ "
54
63
fi
You can’t perform that action at this time.
0 commit comments