2023-11-13 03:12:05 +00:00
|
|
|
# see /usr/share/doc/bash-color-prompt/README.md
|
2023-08-21 15:42:22 +00:00
|
|
|
|
2023-11-11 10:01:09 +00:00
|
|
|
## to truncate \w dirpath set:
|
|
|
|
# PROMPT_DIRTRIM=3
|
|
|
|
|
2023-11-10 07:08:18 +00:00
|
|
|
# only set for color terminals and if PS1 unchanged from bash or fedora defaults
|
2024-06-07 13:06:17 +00:00
|
|
|
if [ -n "${BASH_VERSION}" -a '(' "$PS1" = "[\u@\h \W]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a '(' "${TERM: -5}" = "color" -o "${TERM}" = "linux" ')' -o -n "${bash_prompt_color_force}" ]; then
|
2023-11-11 10:00:34 +00:00
|
|
|
|
2023-11-13 16:52:17 +00:00
|
|
|
PROMPT_COLOR="${PROMPT_COLOR:-32}"
|
|
|
|
PROMPT_USERHOST="${PROMPT_USERHOST:-\u@\h}"
|
|
|
|
PROMPT_SEPARATOR="${PROMPT_SEPARATOR:-:}"
|
|
|
|
PROMPT_DIRECTORY="${PROMPT_DIRECTORY:-\w}"
|
|
|
|
colorpre='\[\e['
|
|
|
|
colorsuf='m\]'
|
|
|
|
colorreset="${colorpre}0${colorsuf}"
|
|
|
|
PS1='${PROMPT_START@P}'"${colorpre}"'${PROMPT_COLOR}'"${colorsuf}"'${PROMPT_USERHOST@P}'"${colorreset}"'${PROMPT_SEPARATOR@P}'"${colorpre}"'${PROMPT_DIR_COLOR:-${PROMPT_COLOR}}'"${colorsuf}"'${PROMPT_DIRECTORY@P}'"${colorreset}"'${PROMPT_END@P}\$'"${colorreset} "
|
2023-11-11 10:00:34 +00:00
|
|
|
|
2023-11-13 04:30:32 +00:00
|
|
|
prompt_default() {
|
|
|
|
PROMPT_COLOR="$1"
|
|
|
|
PROMPT_DIR_COLOR="$2"
|
|
|
|
PROMPT_SEPARATOR=':'
|
|
|
|
PROMPT_DIRECTORY='\w'
|
|
|
|
PROMPT_START=''
|
|
|
|
PROMPT_END=''
|
|
|
|
}
|
2023-11-13 03:36:28 +00:00
|
|
|
|
2023-11-13 04:30:32 +00:00
|
|
|
prompt_traditional() {
|
|
|
|
PROMPT_COLOR="${1:-0}"
|
2023-11-13 16:52:17 +00:00
|
|
|
PROMPT_DIR_COLOR="$2"
|
2023-11-13 04:30:32 +00:00
|
|
|
PROMPT_SEPARATOR=' '
|
|
|
|
PROMPT_DIRECTORY='\W'
|
|
|
|
PROMPT_START='['
|
|
|
|
PROMPT_END=']'
|
|
|
|
}
|
2023-11-13 03:36:28 +00:00
|
|
|
|
2023-11-13 04:30:32 +00:00
|
|
|
prompt_default_os() {
|
2024-06-07 13:09:02 +00:00
|
|
|
eval "$(grep ANSI_COLOR /etc/os-release)"
|
2023-11-13 04:30:32 +00:00
|
|
|
PROMPT_COLOR="$ANSI_COLOR"
|
|
|
|
PROMPT_DIR_COLOR="$1"
|
|
|
|
PROMPT_SEPARATOR=':'
|
|
|
|
PROMPT_DIRECTORY='\w'
|
|
|
|
PROMPT_START=''
|
|
|
|
PROMPT_END=''
|
|
|
|
}
|
2023-11-13 03:36:28 +00:00
|
|
|
|
2023-11-13 04:30:32 +00:00
|
|
|
fi
|