refs #8533 Cut unknown environment prompt to 3 chars

This commit is contained in:
Juan Ferrer 2025-02-06 09:23:01 +01:00
parent 8a907de796
commit ca8c5a6135
1 changed files with 4 additions and 3 deletions

View File

@ -11,6 +11,8 @@ if [ -f "/etc/vn/env" ]; then
fi
read -r VN_ENV < /etc/vn/env
ENV_TEXT="$VN_ENV"
case "$VN_ENV" in
lab)
ENV_COLOR="\033[01;32m"
@ -26,17 +28,16 @@ if [ -f "/etc/vn/env" ]; then
;;
*)
ENV_COLOR="\033[01;36m"
ENV_TEXT="${VN_ENV:0:3}"
;;
esac
ENV_TEXT=${VN_ENV^^}
if [ -z "$ENV_TEXT" ]; then
ENV_TEXT="???"
ENV_COLOR="\033[01;37m"
fi
ENV_TEXT="\[${ENV_COLOR}\]${ENV_TEXT}\[\033[00m\]"
ENV_TEXT="\[${ENV_COLOR}\]${ENV_TEXT^^}\[\033[00m\]"
PS1="\u@$SHORT_HOST[$ENV_TEXT]:\w"
if [ "$(id -u)" -eq 0 ]; then