This is a discussion on No linebreak when coloring prompt within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I have added the following line to /etc/profile: PS1="\e[0;32m$PS1\e[0;0m" Now I have a colored prompt. But if a command ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I have added the following line to /etc/profile: PS1="\e[0;32m$PS1\e[0;0m" Now I have a colored prompt. But if a command is longer then a line, there is no linebreak. It just jumps back to the beginning (carriage return) of the current line. In wish manpage are the escape sequences described? Sebastian -- http://www.halle-ist-schoen.de/ Bilddokumentation der schoensten Saalestadt |
| |||
| On Tue, 13 Apr 2004 14:07:58 -0000, Sebastian Stein <seb_stein@gmx.de> wrote: > I have added the following line to /etc/profile: > > PS1="\e[0;32m$PS1\e[0;0m" > > Now I have a colored prompt. But if a command is longer then a line, there > is no linebreak. It just jumps back to the beginning (carriage return) of > the current line. I found the solution. The correct line must be: PS1="\[\e[0;32m\]$PS1\[\e[0;0m\]" Sebastian -- http://www.hpfsc.de/ - die Seite rund um: Assembler, Bundeswehr, TFT LCDs, Halle/Saale, Fahrradtouren, Neuseeland, Wanderstaat Mauma, Raumschiff USS Nathan, Enemy Room, MLCAD Tutorial |
| ||||
| Sebastian Stein wrote: > I have added the following line to /etc/profile: > > PS1="\e[0;32m$PS1\e[0;0m" > > Now I have a colored prompt. But if a command is longer then a line, there > is no linebreak. It just jumps back to the beginning (carriage return) of > the current line. > > In wish manpage are the escape sequences described? I do it like this and still occasionally the line doesn't wrap properly though not very often. This gives me a red prompt for root and a yellow prompt for users and also shows the CWD. elif [ "`id -un`" = "root" ]; then PS1='\[\033[1;31m\]\h:\w\$\[\033[0m\] '; else PS1='\[\033[1;33m\]\h:\w\$\[\033[0m\] '; fi -- Confucius: He who play in root, eventually kill tree. Registered with The Linux Counter. http://counter.li.org/ Slackware 9.1.0 Kernel 2.4.25 SMP i686 (GCC) 3.3.3 Uptime: 11 days, 23:53, 1 user, load average: 0.01, 0.09, 0.09 |