diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2016-11-04 18:53:16 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2016-11-05 10:25:00 +0100 |
| commit | 093137cdbafc106bedd53189d37265d5d3f5d669 (patch) | |
| tree | 5e62fa37d9bf861a2f731b97c6ebfe92563dbfd9 | |
| parent | 4c9afc91a5e0669abb6e35be395ee80f6ed7f150 (diff) | |
| download | dotfiles-093137cdbafc106bedd53189d37265d5d3f5d669.tar.xz | |
Concatenate instead of echoing
TODO: measure whether this actually changes anything.
| -rw-r--r-- | .bashprompt | 24 |
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 () |
