|
@@ -8,15 +8,35 @@
|
8
|
8
|
### BASH ###
|
9
|
9
|
### '''' ###
|
10
|
10
|
|
|
11
|
+__make_ps1d() {
|
|
12
|
+ lastrv=$(cat /var/tmp/bash-rv/$$.lastrv)
|
|
13
|
+ if [ $lastrv -gt 126 ];
|
|
14
|
+ then
|
|
15
|
+ echo "[0;31m \$"
|
|
16
|
+ elif [ $lastrv -gt 0 ];
|
|
17
|
+ then
|
|
18
|
+ echo "[1;31m \$"
|
|
19
|
+ else
|
|
20
|
+ echo "[1;0m \$"
|
|
21
|
+ fi
|
|
22
|
+}
|
|
23
|
+
|
|
24
|
+__save_rv() {
|
|
25
|
+ echo $1 > /var/tmp/bash-rv/$$.lastrv
|
|
26
|
+}
|
|
27
|
+
|
11
|
28
|
make_ps1() {
|
12
|
29
|
# these functions must be already defined by ~/.bash/user/*.bashrc
|
13
|
30
|
# and ~/.bash/host/*.bashrc
|
|
31
|
+ svrc='$(__save_rv $?)'
|
14
|
32
|
ps1u=$(make_ps1u)
|
15
|
33
|
ps1h=$(make_ps1h)
|
16
|
34
|
ps1w="$lblue\w$normal";
|
17
|
35
|
ps1G='$(__git_ps1 "(%s)")';
|
18
|
36
|
ps1g="$green$ps1G$normal";
|
19
|
|
- echo "$ps1u@$ps1h:$ps1w$ps1g$normal\$ ";
|
|
37
|
+ ps1D='$(__make_ps1d $?)';
|
|
38
|
+ ps1d="$ps1D";
|
|
39
|
+ echo "$svrc$ps1u@$ps1h:$ps1w$ps1g$ps1d$normal ";
|
20
|
40
|
}
|
21
|
41
|
|
22
|
42
|
make_ps2() {
|