git://git.iain.cx/iain
/
profile.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8f2c4b1
)
Some ps1 state variables need wider scope.
author
Iain Patterson
<me@iain.cx>
Mon, 22 Oct 2018 12:31:43 +0000
(13:31 +0100)
committer
Iain Patterson
<me@iain.cx>
Sat, 8 May 2021 08:48:40 +0000
(10:48 +0200)
.profile.d/ps1.bashrc
patch
|
blob
|
history
diff --git
a/.profile.d/ps1.bashrc
b/.profile.d/ps1.bashrc
index
e7d3658
..
80ad1da
100644
(file)
--- a/
.profile.d/ps1.bashrc
+++ b/
.profile.d/ps1.bashrc
@@
-131,7
+131,7
@@
function __ps1_colour_for() {
local colour=
local ret=
for colour in "${1}_colour${__ps1_colours}" "${1}_colour"; do
local colour=
local ret=
for colour in "${1}_colour${__ps1_colours}" "${1}_colour"; do
- ret=$(eval echo -n "\$$colour")
+ eval "export ret=\$$colour"
[ -n "$ret" ] && break
done
echo -n $ret
[ -n "$ret" ] && break
done
echo -n $ret
@@
-140,7
+140,7
@@
function __ps1_colour_for() {
function __ps1_prefix() {
local var=\$${2#\$}
local prefix=${__ps1_all%$var*}
function __ps1_prefix() {
local var=\$${2#\$}
local prefix=${__ps1_all%$var*}
-
local all="$(eval echo $prefix)
"
+
eval "all=\$$prefix
"
[ "${all/1/}" = "$all" ] || echo -n " "
return $1
}
[ "${all/1/}" = "$all" ] || echo -n " "
return $1
}
@@
-299,7
+299,7
@@
function prompt() {
fi
what="$(echo $2 | env LANG= LC_ALL= LC_CTYPE= tr '[:upper:]' '[:lower:]')"
fi
what="$(echo $2 | env LANG= LC_ALL= LC_CTYPE= tr '[:upper:]' '[:lower:]')"
- eval
__ps1_$what=$action
+ eval
"__ps1_$what=$action"
}
__ps1
}
__ps1