From e6a61d1d60141d80bc173bae6184577639ec224e Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 25 May 2021 17:21:02 +0200 Subject: [PATCH] added showPrompt --- inc_bash.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/inc_bash.sh b/inc_bash.sh index 7920ff2..e75f16e 100755 --- a/inc_bash.sh +++ b/inc_bash.sh @@ -6,7 +6,9 @@ typeset -i rc=0 - +# Fetch returncode of last executed command. +# It summarizes all exitcodes into rc (= if any job failed it is <> 0) +# It stores the last exitcode in myrc function fetchrc(){ myrc=$? echo rc=$myrc @@ -21,6 +23,9 @@ function fetchrc(){ # ------------------------------------------------------------ # color text # ------------------------------------------------------------ + + # set a terminal color by a keyword + # param string keyword to set a color; one of reset | head|cmd|input | ok|warning|error function color(){ sColorcode="" case $1 in @@ -44,6 +49,12 @@ function fetchrc(){ fi } + + function showPrompt(){ + color input + echo -n "$*" + color reset + } # ---------------------------------------------------------------------- # headlines # ---------------------------------------------------------------------- @@ -68,7 +79,8 @@ function fetchrc(){ function h3(){ color head - echo "----- $*" + echo + echo "---------- $*" color reset } -- GitLab