From 88162d22fe44d12878599fc106081a37e4c74eaf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 12 Nov 2024 10:18:44 +0100 Subject: [PATCH] prompt --- bash/bash/prompt.sh | 56 ++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/bash/bash/prompt.sh b/bash/bash/prompt.sh index 2fd0724..069b34e 100644 --- a/bash/bash/prompt.sh +++ b/bash/bash/prompt.sh @@ -1,32 +1,32 @@ ps1() { - local code=${1} - local date="$(date +%H:%M:%S)" - local git - local host="$(hostname)" - local path="${PWD}" - local user="${USER}" - 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}\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}" + local code=${1} + local date="$(date +%H:%M:%S)" + local git + local host="$(hostname)" + local path="${PWD}" + local user="${USER}" + 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}\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="\$(ps1 \${?})"