Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
06-03-2011, 11:21 AM
|
#1
|
|
LQ Newbie
Registered: Mar 2009
Posts: 5
Rep:
|
Bash PS1
Hey
I just figured out how I can change the look of my shell and I've been tinkering arround with the PS1 and adding some colour to it (for now :-)). I'm quite happy with the new look, it has only 1 problem.
If i type a command that's too long and should continue on a new line, it just jumps to the start of the line and prints over the shell prompt. If i use the default prompt, it works like it should
Eg:
fraeco@linux:/this/is/a/long/path$ with_an_even_l
onger_command
This is ok, but now with the modification I made it goes like this
onger_command/this/is/a/long/path$ with_an_even_l
My default PS1 is this
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
The one I made is this: "\e[1;34m\u@\h:\e[m\w\$ "
What needs to be there, to make it function like before again?
|
|
|
|
06-03-2011, 11:27 AM
|
#2
|
|
Senior Member
Registered: Aug 2006
Location: C:\MSDOS\
Distribution: LFS 3.8.11 with OpenBox 3.5.0
Posts: 1,458
|
Hello!
Mine is this:
Code:
PS1='\[\033[1;31m\]\[\033[1;30m\](\[\033[1;34m\]\u\[\033[1;37m\]@\[\033[0;37m\]\h\[\033[1;30m\])-(\[\033[0;37m\]\@\[\033[0;32m\] \[\033[1;34m\]\d\[\033[1;30m\])-(\[\033[1;32m\]\w\[\033[1;30m\])\[\033[0;34m\]\n\[\033[1;34m\]\$ \[\033[1;37m\]>\[\033[0;37m\]'
export PS1
|
|
|
|
06-03-2011, 11:38 AM
|
#3
|
|
Member
Registered: Apr 2010
Location: USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix
Posts: 731
Rep: 
|
PS1
There are several tricks you can use, even placing some of the information at the TOP pf the screen and the REST at the cursor location. What I decided in your position was that more than one half line is too long a prompt!
|
|
|
|
06-03-2011, 01:00 PM
|
#4
|
|
Member
Registered: Aug 2009
Distribution: CentOS
Posts: 692
|
When your prompt includes a non-printing terminal control sequence, you need to bracket that sequence with \[ and \] to tell bash that the characters within the brackets do not advance the cursor position.
|
|
|
1 members found this post helpful.
|
06-05-2011, 04:24 AM
|
#5
|
|
LQ Newbie
Registered: Mar 2009
Posts: 5
Original Poster
Rep:
|
Quote:
Originally Posted by rknichols
When your prompt includes a non-printing terminal control sequence, you need to bracket that sequence with \[ and \] to tell bash that the characters within the brackets do not advance the cursor position.
|
This was what I was looking for, after inserting the brackets before and after my shell behaves the way it shouls again. Thnx all!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:26 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|