From fff7d4005078e26c93d64bf1cf1f63440a21fd0e Mon Sep 17 00:00:00 2001 From: Mehdi Sadeghi Date: Tue, 12 Mar 2024 14:53:44 +0100 Subject: Fix prompt (extra -e in output) Moreover, remove debug prints (breaks SSH) --- .bashrc | 8 ++++---- .env | 3 --- .local/bin/prompt | 4 ++-- .profile | 9 ++++----- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.bashrc b/.bashrc index f23a6f2..b7c210f 100644 --- a/.bashrc +++ b/.bashrc @@ -1,5 +1,4 @@ # .bashrc -echo .bashrc begin # Make a history backup since history is lost sometimes BACKUPS=~/Backups/$(date +%Y)/bash_hist/ @@ -9,7 +8,10 @@ cp ~/.bash_history $BACKUPS/$(date +%s) # Load ENV file (shared with POSIX shell) [ $0 != sh ] && [ -n "${ENV:=$HOME/.env}" ] && . "$ENV" -PS1='\[\033[1;33m\]$($HOME/.local/bin/prompt)\[\033[0m\]' +COLOR="\[$(tput setaf 3)\]" # yellow +RESET="\[$(tput sgr0)\]" + +PS1='\[$(tput setaf 3)\]$($HOME/.local/bin/prompt)\[$(tput sgr0)\]' # Warn if .bash_profile exists (since it will prevent loading .profile) [[ -f ~/.bash_profile ]] && echo WARN: .bash_profile exists @@ -51,5 +53,3 @@ _direnv_hook() { if ! [[ "${PROMPT_COMMAND:-}" =~ _direnv_hook ]]; then PROMPT_COMMAND="_direnv_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" fi - -echo .bashrc end diff --git a/.env b/.env index 0e38fd0..bd226b6 100644 --- a/.env +++ b/.env @@ -1,6 +1,4 @@ # .env -echo .env begin - PS1='$(prompt)' # sh history config @@ -67,4 +65,3 @@ gpg-connect-agent updatestartuptty /bye >/dev/null # Null keyring for python - avoids problems with wallets export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring -echo .env end diff --git a/.local/bin/prompt b/.local/bin/prompt index 920a5ef..1f06085 100755 --- a/.local/bin/prompt +++ b/.local/bin/prompt @@ -4,6 +4,6 @@ BRANCH=$(test -n "$BRANCH" && echo "($BRANCH)") HIST_COUNT=$(grep -v '^#' ~/.bash_history | wc -l) PROMPT="$USER@$(cat /proc/sys/kernel/hostname)[$HIST_COUNT]:$( test "$PWD" = $HOME && echo '~' || echo "$PWD")$BRANCH" case $(id -u) in -0) echo -e "$PROMPT\\n# " ;; -*) echo -e "$PROMPT\\n$ " ;; +0) printf "$PROMPT\\n# " ;; +*) printf "$PROMPT\\n$ " ;; esac diff --git a/.profile b/.profile index ba156f1..4ffa9ec 100644 --- a/.profile +++ b/.profile @@ -1,10 +1,11 @@ # .profile -echo .profile begin +source /etc/profile +export TERM=xterm-256color export ENV=~/.env -export LANG=en_US.UTF-8 +export LANG=en_GB.UTF-8 export LANGUAGE=en -export LC_ALL=en_US.UTF-8 +export LC_ALL=en_GB.UTF-8 export EDITOR=vim # Try wayland for GTK apps first, allow x11 fallback @@ -28,5 +29,3 @@ HOSTNAME=$(cat /proc/sys/kernel/hostname) export VOLTA_HOME="$HOME/.volta" export PATH="$VOLTA_HOME/bin:$PATH" - -echo .profile end -- cgit v1.2.3