From a11b3078d41e36fbdbab3f1773896a1d5c07cb15 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Mon, 22 Oct 2018 13:31:43 +0100 Subject: [PATCH] Some ps1 state variables need wider scope. --- .profile.d/ps1.bashrc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.profile.d/ps1.bashrc b/.profile.d/ps1.bashrc index e7d3658..80ad1da 100644 --- 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 - ret=$(eval echo -n "\$$colour") + eval "export ret=\$$colour" [ -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*} - local all="$(eval echo $prefix)" + eval "all=\$$prefix" [ "${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:]')" - eval __ps1_$what=$action + eval "__ps1_$what=$action" } __ps1 -- 2.20.1