change parameter-expanson from ${parameter@P}

to use variables
This commit is contained in:
Jakobus Schürz 2020-07-14 08:37:43 +02:00
parent 8cf3142751
commit c082fc3496

12
PS1
View file

@ -1,8 +1,11 @@
# /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells. # /etc/profile.d/PS1.sh: executed by Bourne-compatible login shells.
parse_git_branch() { parse_git_branch() {
# local git-branch
local LBRANCH="$(git branch 2>/dev/null | sed -ne 's/* \(.*\)/ \1/p'|sed -e 's/^[[:blank:]]*//;s/[[:blank:]]*$//')" 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:]]*//' )" 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 [ -z "${RBRANCH-x}" ] && unset RBRANCH
local BRANCH="${LBRANCH}${RBRANCH+ -> }${RBRANCH}" local BRANCH="${LBRANCH}${RBRANCH+ -> }${RBRANCH}"
[ -z "${BRANCH-x}" ] || echo "($BRANCH)"|tr -s '()' [ -z "${BRANCH-x}" ] || echo "($BRANCH)"|tr -s '()'
@ -16,13 +19,16 @@ set_label() {
# Labels: remote, tmpconfig, screen... # Labels: remote, tmpconfig, screen...
if [ ! -z ${SSH_TTY:+x} ]; then if [ ! -z ${SSH_TTY:+x} ]; then
#LABEL="${LABEL} \[$On_IRed\]\[$BBlack\]remote\[$Color_Off\]" #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 fi
if $SSHS ; then 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}"
#LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]"
fi fi
echo ${LABEL@P} echo -e ${LABEL}
#echo ${LABEL@P}
} }
if [ -x "/usr/bin/getsyssubvol" ]; then if [ -x "/usr/bin/getsyssubvol" ]; then