From 41a6006ed57f611e24243be708e34850ab921fb4 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 30 Apr 2022 20:24:47 +1200 Subject: Correct prompt status writing broken by preload --- bash/bashrc.d/prompt.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'bash/bashrc.d') diff --git a/bash/bashrc.d/prompt.bash b/bash/bashrc.d/prompt.bash index 86691a9c..bdea7ace 100644 --- a/bash/bashrc.d/prompt.bash +++ b/bash/bashrc.d/prompt.bash @@ -7,7 +7,7 @@ prompt() { # Turn complex, colored PS1 and debugging PS4 prompts on on) # Set up pre-prompt command - PROMPT_COMMAND='history -a' + PROMPT_COMMAND='PROMPT_RETURN=$?;history -a' # If Bash 4.0 is available, trim very long paths in prompt if ((BASH_VERSINFO[0] >= 4)) ; then @@ -31,7 +31,7 @@ prompt() { ## Preload libraries as prefix PS1='$(prompt preload)'$PS1 ## VCS, job, and return status checks as suffixes - PS1=$PS1'$(ret=$?;prompt vcs;prompt job;prompt ret)' + PS1=$PS1'$(prompt vcs;prompt job;prompt ret)' # Add prefix and suffix PS1='${PROMPT_PREFIX}'$PS1'${PROMPT_SUFFIX}' @@ -267,8 +267,8 @@ prompt() { # Show return status of previous command in angle brackets, if not zero ret) # shellcheck disable=SC2154 - ((ret)) || return - printf '<%u>' "${ret//\\/\\\\}" + ((PROMPT_RETURN)) || return + printf '<%u>' "${PROMPT_RETURN//\\/\\\\}" ;; # Show the count of background jobs in curly brackets, if not zero -- cgit v1.2.3