bash/prompt/enhance

This commit is contained in:
Marc Beninca 2023-08-21 11:43:50 +02:00
parent 8afbad6e4c
commit e876f37b7d

View file

@ -8,22 +8,28 @@ local git
local host="$(hostname)"
local path="${PWD}"
local user="${USER}"
local view="\
${date}\
\e[0;31m${code}\e[0m\
\e[0;32m${user}\e[0m\
@ \e[0;33m${host}\e[0m\
"
local view="└ "
if [ ${code} -ne 0 ] ; then
view="${view}\e[0;31m"
else
view="${view}\e[0;32m"
fi
view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m"
if [ "$(type -t __git_ps1)" == 'function' ] ; then
git="$(__git_ps1)"
if [ "${git}" ] ; then
view="${view} –\e[0;35m${git}\e[0m"
fi
fi
view="${view}
\e[0;36m${path}\e[0m
${PS2}"
echo -e "${view}"
view="${view}\n \e[0;36m${path}\e[0m"
view="${view}\n┌ "
if [ ${EUID} -eq 0 ] ; then
view="${view}\e[0;31m"
else
view="${view}\e[0;32m"
fi
view="${view}${user}\e[0m @ \e[0;33m${host}\e[0m"
echo -e "${view}\n${PS2}"
}
PS1='$(eval ps1 ${?})'