From 9e91389b54626d5e53fd4106d792f719391aac39 Mon Sep 17 00:00:00 2001 From: Doncho Gunchev Date: Sat, 17 Oct 2020 13:04:11 +0300 Subject: [PATCH] Speed up fill generation, preserve $? for others. --- bash/ps-twtty-7.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bash/ps-twtty-7.sh b/bash/ps-twtty-7.sh index ba3e894..2248336 100755 --- a/bash/ps-twtty-7.sh +++ b/bash/ps-twtty-7.sh @@ -55,7 +55,7 @@ function prompt_command_exit() { } function prompt_command() { - # Save the error code + # Save the error code, running any external command resets it! local E=$? # Date, my format @@ -87,7 +87,7 @@ function prompt_command() { let fillsize=${COLUMNS}-${#prompt} my_FILL="" if [ $fillsize -gt 0 ]; then - my_FILL="─" + my_FILL="────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────" while [ $fillsize -gt ${#my_FILL} ]; do my_FILL="${my_FILL}${my_FILL}${my_FILL}${my_FILL}" done @@ -100,6 +100,8 @@ function prompt_command() { else my_PWD="${PWD}" fi + # Let other PROMPT_COMMAND scripts (if any after us) have the error code too. + bash -c "exit $E" } function twtty {