Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have defined a PS1 prompt multi-line in my server with Ubuntu 11.04.
The problem occurs when I write a long command, the line cuts before the end of terminal and it continues at beginning the same line:
screen capture 1

But if I continue writing the line ends at the end of window and it continues in next line, as expected:
screen capture 2

And if I press Home key the cursor goes to the line above the first line.

I connect to server with SSH in a gnome-terminal.

The PS1 line in /etc/bash.bashrc is:

[ $UID -eq "0" ] && PS1="\e[31m┏━\e[42m┅◉ \e[37m\d ⌚ \t \e[31m┅\e[0m\e[31m━━\e[42m┅◈ \e[37m\H \e[0m\n\e[31m┣\e[0m \w (\e[36m\$(ls -1 | wc -l) fichero/s\e[0m) \n\e[31m┗\e[45m┅◉\e[1;37m \u \e[0m\e[31m━► " || PS1="┏━\e[44m┅◉ \e[37m\d ⌚ \t ┅\e[0m━━\e[44m┅◈ \e[37m \e[0m\n┣━━\e[42m┅◉ kernel: \e[37m$(uname -r) ┅\e[0m━━\e[42m┅◈ uptime: \e[37m$(date -d "`cut -f1 -d. /proc/uptime` seconds ago" +"%a %d %b %R") \e[0m\n┣ \w (\e[36m\$(ls -1 | wc -l) fichero/s\e[0m) \n┗\e[46m┅◉\e[1;37m \u \e[0m━► "

Some of the environment variables:

$ env
TERM=xterm
SHELL=/bin/bash
SSH_TTY=/dev/pts/0
LC_ALL=
LC_MESSAGES=POSIX
LC_COLLATE=C
LANG=es_ES.UTF-8
HISTCONTROL=ignoreboth
SHLVL=1
LESS=-Rsw
LESSOPEN=| /usr/bin/lesspipe %s
LESSCLOSE=/usr/bin/lesspipe %s %s
_=/usr/bin/env

Any idea?

share|improve this question
    
Does this occur with the normal PS1 variable? –  jrg Oct 17 '11 at 0:02
    
It's the PS1 that's the problem. When I try it here, I get the same issue. –  Oli Oct 17 '11 at 0:37
add comment

1 Answer

up vote 2 down vote accepted

Here I fixed it for you :

Here the first one :

PS1='\[\e[0;31m\]┏━\[\e[42m\]┅◉ \[\e[0;37m\]\[\e[42m\]\d ⌚ \t \[\e[0;31m\]┅\[\e[0m\]\[\e[0;31m\]━━\[\e[42m\]┅◈ \[\e[0;37m\]\[\e[42m\]\H \[\e[0m\]\n\[\e[0;31m\]┣\[\e[0m\] \w (\[\e[36m\]$(ls -1 | wc -l) fichero/s\[\e[0m\]) \n\[\e[0;31m\]┗\[\e[45m\]┅◉\[\e[1;37m\]\[\e[45m\] \u \[\e[0m\]\[\e[0;31m\]━► '

And the second one :

PS1='┏━\[\e[44m\]┅◉ \[\e[0;37m\]\[\e[44m\]\d ⌚ \t ┅\[\e[0m\]━━\[\e[44m\]┅◈ \[\e[0;37m\]\[\e[44m\] \[\e[0m\]\n┣━━\[\e[42m\]┅◉ kernel: \[\e[0;37m\]\[\e[42m\]$(uname -r) ┅\[\e[0m\]━━\[\e[42m\]┅◈ uptime: \[\e[0;37m\]\[\e[42m\]$(date -d "`cut -f1 -d. /proc/uptime` seconds ago" +"%a %d %b %R") \[\e[0m\]\n┣ \w (\[\e[0;36m\]$(ls -1 | wc -l) fichero/s\[\e[0m\]) \n┗\[\e[46m\]┅◉\[\e[1;37m\] \u \[\e[0m\]━► '
share|improve this answer
    
Thank you very much. I didn't know that it was necessary to enclose the color codes between brackets. –  Simón Oct 17 '11 at 14:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.