summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2016-11-04 18:53:16 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2016-11-05 10:25:00 +0100
commit093137cdbafc106bedd53189d37265d5d3f5d669 (patch)
tree5e62fa37d9bf861a2f731b97c6ebfe92563dbfd9
parent4c9afc91a5e0669abb6e35be395ee80f6ed7f150 (diff)
downloaddotfiles-093137cdbafc106bedd53189d37265d5d3f5d669.tar.xz
Concatenate instead of echoing
TODO: measure whether this actually changes anything.
-rw-r--r--.bashprompt24
1 files changed, 13 insertions, 11 deletions
diff --git a/.bashprompt b/.bashprompt
index d7a6a54..0ce903f 100644
--- a/.bashprompt
+++ b/.bashprompt
@@ -40,14 +40,14 @@ __fontify ()
codes[dim]='2'
codes[clear]='0'
- local string=$1
+ local text=$1
shift
# We need to add \[ \] around CSI sequences so that Bash can tell which
# characters are non-printing.
- __start-nonprinting
- echo -en '\033['
+ output=$(__start-nonprinting)
+ output+='\033['
local attributes=($@)
local nb=$#
@@ -55,22 +55,24 @@ __fontify ()
for ((i=0; i<nb; i++))
do
a=${attributes[${i}]}
- echo -en ${codes[${a}]}
+ output+=${codes[${a}]}
if ((i<nb-1))
then
- echo -en ';'
+ output+=';'
else
- echo -en 'm'
+ output+='m'
fi
done
- __end-nonprinting
+ output+=$(__end-nonprinting)
- echo -n "${string}"
- __start-nonprinting
- echo -en "\033[0m"
- __end-nonprinting
+ output+="${text}"
+ output+=$(__start-nonprinting)
+ output+='\033[0m'
+ output+=$(__end-nonprinting)
+
+ echo -en "${output}"
}
__set-prompt ()