From 62a33a5583853413e151e65783a1f0c086f0537a Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 16 Nov 2024 01:41:42 +0100 Subject: [PATCH] wip/fixes --- shell/shell.sh | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/shell/shell.sh b/shell/shell.sh index 9e2b27e..82a1ed2 100644 --- a/shell/shell.sh +++ b/shell/shell.sh @@ -1,29 +1,30 @@ -[ "$(cat /proc/$$/comm)" = "bash" ] || return +SH="$(cat /proc/$$/comm)" -# completion - -file="/usr/share/bash-completion/bash_completion" - -if [ -f "${file}" ]; then - . "${file}" -fi - -# history - -HISTCONTROL="ignorespace" - -HISTSIZE=-1 - -HISTTIMEFORMAT="%Y%m%d %H%M%S " +case "${SH}" in +"bash") + # completion + file="/usr/share/bash-completion/bash_completion" + if [ -f "${file}" ]; then + . "${file}" + fi + # history + HISTCONTROL="ignorespace" + HISTSIZE=-1 + HISTTIMEFORMAT="%Y%m%d %H%M%S " + ;; +*) + ;; +esac # prompt ps1() { - local date host + local date host id local code="${1}" date="$(date +%H:%M:%S)" local git host="$(hostname)" + id="$(id --user)" local path="${PWD}" local user="${USER}" local view="ā”” " @@ -33,7 +34,7 @@ ps1() { view="${view}\e[0;32m" fi view="${view}${code}\e[0m @ \e[0;33m${date}\e[0m" - if [ "$(type -t __git_ps1)" == "function" ]; then + if [ "$(type -t __git_ps1)" = "function" ]; then git="$(__git_ps1)" if [ -n "${git}" ]; then view="${view} ā€“\e[0;35m${git}\e[0m" @@ -41,7 +42,7 @@ ps1() { fi view="${view}\n\e[0;36m${path}\e[0m" view="${view}\nā”Œ " - if [ ${EUID} -eq 0 ]; then + if [ "${id}" -eq 0 ]; then view="${view}\e[0;31m" else view="${view}\e[0;32m"