From c082fc34969fd4592d0e4e99b021456d76a25982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakobus=20Sch=C3=BCrz?= Date: Tue, 14 Jul 2020 08:37:43 +0200 Subject: [PATCH] change parameter-expanson from ${parameter@P} to use variables --- PS1 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/PS1 b/PS1 index 095e0bd..68d7b41 100644 --- a/PS1 +++ b/PS1 @@ -1,8 +1,11 @@ # /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells. parse_git_branch() { + # local git-branch local LBRANCH="$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ \1/p'|sed -e 's/^[[:blank:]]*//;s/[[:blank:]]*$//')" + # remote git-branch local RBRANCH="$( git rev-parse --symbolic-full-name --abbrev-ref @{u} 2>/dev/null |sed -e 's/^[[:blank:]]*//' )" + # unset RBRANCH if it is empty [ -z "${RBRANCH-x}" ] && unset RBRANCH local BRANCH="${LBRANCH}${RBRANCH+ -> }${RBRANCH}" [ -z "${BRANCH-x}" ] || echo "($BRANCH)"|tr -s '()' @@ -16,13 +19,16 @@ set_label() { # Labels: remote, tmpconfig, screen... if [ ! -z ${SSH_TTY:+x} ]; then #LABEL="${LABEL} \[$On_IRed\]\[$BBlack\]remote\[$Color_Off\]" - LABEL="${LABEL} \[$On_IRed\]remote\[$Color_Off\]" + LABEL="${LABEL} ${On_IRed}${BBlack}remote${Color_Off}" + #LABEL="${LABEL} \[$On_IRed\]remote\[$Color_Off\]" fi if $SSHS ; then #LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]" - LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]" + LABEL="${LABEL} ${On_IWhite}${BBlack}tmpconfig${Color_Off}" + #LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]" fi - echo ${LABEL@P} + echo -e ${LABEL} + #echo ${LABEL@P} } if [ -x "/usr/bin/getsyssubvol" ]; then