diff options
| author | mail_redacted_for_web | 2026-03-11 02:03:45 +0100 |
|---|---|---|
| committer | mail_redacted_for_web | 2026-03-11 02:03:45 +0100 |
| commit | cf4ad66b492dce1c4044591a23e151bdf042b6f9 (patch) | |
| tree | 7b7a53b5dfa39467dfcecf610a8ada425b71f250 | |
| parent | 5d0c5681a7a1eefb2135c9816d4d9c6e02d58ecc (diff) | |
| download | dotfiles-cf4ad66b492dce1c4044591a23e151bdf042b6f9.tar.bz2 | |
feat: include OS version in prompt
| -rw-r--r-- | .bash/prompt.bash | 29 | ||||
| -rw-r--r-- | .bash/vars.bash | 5 |
2 files changed, 32 insertions, 2 deletions
diff --git a/.bash/prompt.bash b/.bash/prompt.bash index 9adc360..2a368f9 100644 --- a/.bash/prompt.bash +++ b/.bash/prompt.bash @@ -155,12 +155,37 @@ __prompt_command() { else local EXIT2="$EXIT" fi + PS1='\[\033[2m\033[3m\]\#\[\033[0m\] ' + if [ "$OSVER" ]; then + PS1+='\[\033[48;5;237m\033[\033[38;5;253m\] ' + PS1+="$OSVER" + PS1+=' \[\033[0m\] ' + fi + PS1+='\[\033[1m\]\[' + PS1+="$($FGC1)" + PS1+='\]' case "$MYUID" in 0) - PS1="\[\\033[2m\\033[3m\]\\#\[\\033[0m\] \[$(tput bold)\]\[$($FGC1)\]\\u\[$($FGC2)\]@$PHN \[$($FGC3)\]\\w \[$(tput sgr0)\]\\n" + # PS1="\[\\033[2m\\033[3m\]\\#\[\\033[0m\] \[$(tput bold)\]\[$($FGC1)\]\\u\[$($FGC2)\]@$PHN \[$($FGC3)\]\\w \[$(tput sgr0)\]\\n" + PS1+='\u\[' + PS1+="($FGC2)" + PS1+='\]' + PS1+="@$PHN" + PS1+='\[' + PS1+="$($FGC3)" + PS1+='\]\w \[\033[0m\]\n' ;; *) - PS1="\[\\033[2m\\033[3m\]\\#\[\\033[0m\] \[$(tput bold)\]\[$($FGC1)\]\t \[$($FGC2)\]\\u$UHSEP\[$($FGC3)\]$PHN \\w \[$(tput sgr0)\]\\n" + # PS1="\[\\033[2m\\033[3m\]\\#\[\\033[0m\] \[$(tput bold)\]\[$($FGC1)\]\t \[$($FGC2)\]\\u$UHSEP\[$($FGC3)\]$PHN \\w \[$(tput sgr0)\]\\n" + PS1+='\t \[' + PS1+="$($FGC2)" + PS1+='\]\u' + PS1+="$UHSEP" + PS1+='\[' + PS1+="$($FGC3)" + PS1+='\]' + PS1+="$PHN" + PS1+=' \w \[\033[0m\]\n' ;; esac # git-completion. Sources: diff --git a/.bash/vars.bash b/.bash/vars.bash index 8b99807..55a59f3 100644 --- a/.bash/vars.bash +++ b/.bash/vars.bash @@ -28,6 +28,11 @@ done # $OSNAME if [ -r "/etc/os-release" ];then OSNAME="$(grep ^ID /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + if grep '^DEBIAN_VERSION_FULL' /etc/os-release >/dev/null 2>&1; then + OSVER="$(grep '^DEBIAN_VERSION_FULL' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + else + OSVER="$(grep '^VERSION_ID' /etc/os-release|awk -F= '{print $NF}'|head -n1|sed 's/"//g')" + fi elif [ "$(uname -s)" == 'SunOS' ]; then OSNAME="sunos" elif [ -r "/etc/redhat-release" ];then grep -E "^Red[\ ]?[Hh]at" /etc/redhat-release >/dev/null 2>&1 && OSNAME="redhat" |
