From: Iain Patterson Date: Mon, 22 Oct 2018 12:31:43 +0000 (+0100) Subject: Some ps1 state variables need wider scope. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=a11b3078d41e36fbdbab3f1773896a1d5c07cb15;p=profile.git Some ps1 state variables need wider scope. --- 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