make LABEL dynamic
This commit is contained in:
parent
d45cf3484e
commit
23105d4f20
1 changed files with 23 additions and 20 deletions
43
PS1
43
PS1
|
@ -8,15 +8,19 @@ parse_git_branch() {
|
||||||
|
|
||||||
set_label() {
|
set_label() {
|
||||||
local LABEL
|
local LABEL
|
||||||
|
SSHS=${SSHS-false}
|
||||||
|
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\]"
|
||||||
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\]"
|
||||||
fi
|
fi
|
||||||
echo $LABEL
|
echo ${LABEL@P}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ -x "/usr/bin/getsyssubvol" ]; then
|
if [ -x "/usr/bin/getsyssubvol" ]; then
|
||||||
|
@ -113,7 +117,6 @@ On_ICyan='\e[0;106m' # Cyan
|
||||||
On_IWhite='\e[0;107m' # White
|
On_IWhite='\e[0;107m' # White
|
||||||
|
|
||||||
LABEL=""
|
LABEL=""
|
||||||
SSHS=${SSHS-false}
|
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
xterm*|rxvt*|screen*)
|
xterm*|rxvt*|screen*)
|
||||||
case "$TERM" in
|
case "$TERM" in
|
||||||
|
@ -122,12 +125,12 @@ case "$TERM" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# 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\]"
|
||||||
fi
|
# fi
|
||||||
if $SSHS ; then
|
# if $SSHS ; then
|
||||||
LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]"
|
# LABEL="${LABEL} \[$On_IWhite\]\[$BBlack\]tmpconfig\[$Color_Off\]"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Base prompt
|
# Base prompt
|
||||||
# if [ "`id -u`" -eq 0 ]; then
|
# if [ "`id -u`" -eq 0 ]; then
|
||||||
|
@ -136,27 +139,27 @@ case "$TERM" in
|
||||||
# PS1="\[$BIBlue\]$SCREEN\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$LABEL\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
|
# PS1="\[$BIBlue\]$SCREEN\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$LABEL\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
|
||||||
# fi
|
# fi
|
||||||
if [ "`id -u`" -eq 0 ]; then
|
if [ "`id -u`" -eq 0 ]; then
|
||||||
PS1="\[$BRed\]$SCREEN\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# "
|
PS1="\[$BRed\]$SCREEN\u@\h \[$BRed\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BRed\]# "
|
||||||
else
|
else
|
||||||
PS1="\[$BIBlue\]$SCREEN\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
|
PS1="\[$BIBlue\]$SCREEN\u@\h \[$BIBlue\]\[\e[m\]\[$IPurple\](\A)\[\e[m\]\$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \[\e[m\]\[$BIBlue\]\$ "
|
||||||
fi
|
fi
|
||||||
RETVAL0="\342\234\223"
|
RETVAL0="\342\234\223"
|
||||||
RETVALN0="\342\234\227 "
|
RETVALN0="\342\234\227 "
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Labels: remote, tmpconfig, screen...
|
# Labels: remote, tmpconfig, screen...
|
||||||
if [ ! -z ${SSH_TTY:+x} ]; then
|
# if [ ! -z ${SSH_TTY:+x} ]; then
|
||||||
LABEL="${LABEL} \[$On_Red\]\[$BWhite\]remote\[$Color_Off\]"
|
# LABEL="${LABEL} \[$On_Red\]\[$BWhite\]remote\[$Color_Off\]"
|
||||||
fi
|
# fi
|
||||||
if $SSHS ; then
|
# if $SSHS ; then
|
||||||
LABEL="${LABEL} \[$On_White\]\[$BBlack\]tmpconfig\[$Color_Off\]"
|
# LABEL="${LABEL} \[$On_White\]\[$BBlack\]tmpconfig\[$Color_Off\]"
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
# Base prompt
|
# Base prompt
|
||||||
if [ "`id -u`" -eq 0 ]; then
|
if [ "`id -u`" -eq 0 ]; then
|
||||||
PS1="\[$BRed\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]$LABEL\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
|
PS1="\[$BRed\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]\$(set_label)\n\[$BRed\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
|
||||||
else
|
else
|
||||||
PS1="\[$BBlue\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]$LABEL\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
|
PS1="\[$BBlue\][$SYSSUBVOL]\u@\h \[$BIBlue\]\[\e[m\]\[$BIPurple\](\A)\[\e[m\]\[$BBlue\]\$(set_label)\n\[$BIBlue\]${SYSSUBVOL}\w:\$(parse_git_branch) \$ \[\e[m\]\[$Blue\]"
|
||||||
fi
|
fi
|
||||||
RETVAL0=":)"
|
RETVAL0=":)"
|
||||||
RETVALN0=":("
|
RETVALN0=":("
|
||||||
|
|
Loading…
Reference in a new issue