1

In Bash when I type at the beginning of a long line the characters are masked with an invisible mark and sometimes adding weird long lines as you can see in the picture below.

This is my PS1 export, I don't know if it's the cause. Does anyone know what part of .bashrc might be causing this?

Im using Terminator, it also happens in the default Ubuntu terminal.

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
 
cust1=$(echo -e "\033[0;97m\]\u\033[1;97m\]->\033[0m")
export PS1="\n[\[\033[0;94m\]\]\w\[\033[0m\[\033[38;5;15m\]]\[\033[0;93m\$(parse_git_branch)\[\e[00m\]\n${cust1}\[\033[0m\] "

If you can see the GIF below, does anyone have any idea what causes this?

Text

wjandrea
  • 28,235
  • 9
  • 60
  • 81
JREAM
  • 5,741
  • 11
  • 46
  • 84
  • 1
    First, don't use echo, you can use C style escapes directly in bash's `PS1`. Second, all non printing characters (ie. colours) must be escaped, by enclosing in backslash square brackets: `cust1='\[\033[0;97m\]\u\[\033[1;97m\]->\[\033[0m\]'` – dan Jun 20 '22 at 06:51

0 Answers0