Results 1 to 2 of 2

Thread: color & customize bash prompt wrecks line length

  1. #1

    Question color & customize bash prompt wrecks line length

    Leap 42.1 64bit

    I'm using this in my .bashrc to colorize my bash prompt. For some reason though it is shortening the number of columns (line length) that I can type. Like about 60 characters even though I have a big maximized konsole window. Same thing happens in a real tty. Any ideas?


    prbold=$(tput bold)
    red=$(tput setaf 1)
    green=$(tput setaf 2)
    blue=$(tput setaf 4)
    yellow=$(tput setaf 3)
    magenta=$(tput setaf 5)
    reset=$(tput sgr0)


    PS1="$prbold[$red\u$reset$prbold@$blue\h$reset $prbold$magenta\w$reset$prbold]$green>$reset "

  2. #2

    Default Re: color & customize bash prompt wrecks line length

    I found the answer in Arch wiki. Its working now :

    Note: Wrapping the tput output in \[ \] is recommended by the Bash man page. This helps Bash ignore non-printable characters so that it correctly calculates the size of the prompt.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •