LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 04-26-2014, 04:52 PM   #1
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Rep: Reputation: 5
Prompt changing problem


nano $HOME/.bashrc
export PS1="\[\e[0;36m\\u\e[0;39m@\e[0;36m\\h\\W\e[m\\$\]"

I have made the above change to the terminal prompt in the .bashrc file to be able to find the former prompt more easily after a list, etc command. It works ok, but it you type something and then press the backspace key beyond the first letter typed, the entire prompt disappears. Anyone know how to make that stop?

Last edited by battles; 04-26-2014 at 04:54 PM.
 
Old 04-27-2014, 01:12 AM   #2
kooru
Senior Member
 
Registered: Sep 2012
Posts: 1,385

Rep: Reputation: 273Reputation: 273Reputation: 273
I've tested your PS1 and I don't have any problem.
 
Old 04-27-2014, 02:38 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,544

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
My first thought would be that you should try using single quotes instead of double in case something is being interpreted incorrectly.
I did notice the double escape prior to $ symbol, which means you would end up with '\$]' at the end ... not sure if this is then being interpreted differently??
 
Old 04-27-2014, 05:18 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,668

Rep: Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855Reputation: 2855
for me it looks like not a prompt settings problem but a terminal config issue.
 
Old 04-27-2014, 06:59 AM   #5
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
Tried everything suggested with same results. I am using putty for the terminal. I think that pan64 might be right. If I am going to use this, I will just have to put up with it. The only thing that was bugging me was that when I used AutoHotKeys to paste something into the terminal, it would over write the prompt with the AutoHotKeys data. If I put a space in before using AutoHotKeys to write in the data, the prompt remains.
Thanks.
 
Old 04-27-2014, 07:12 AM   #6
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 335

Rep: Reputation: 141Reputation: 141
Putting the whole of the prompt in escaped square brackets is wrong because it means the prompt should have zero width on the screen. Only non-printing characters should be put in escaped square brackets.
http://www.tldp.org/HOWTO/Bash-Promp...tingchars.html

Code:
# Instead of
PS1="\[\e[0;36m\\u\e[0;39m@\e[0;36m\\h\\W\e[m\\$\]"
# Try
PS1="\[\e[0;36m\]\\u\[\e[0;39m\]@\[\e[0;36m\]\\h\\W\[\e[m\]\\$"

Last edited by Kenhelm; 04-27-2014 at 07:14 AM.
 
Old 04-27-2014, 07:30 AM   #7
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
PS1="\[\e[0;36m\]\\u\[\e[0;39m\]@\[\e[0;36m\]\\h\\W\[\e[m\]\\$"

That fixed it!

I read an example somewhere that said the whole string needed to be within \[...\], but they were actually referring to the color code only.

I also like a space between the prompt and the #, so I use this:

PS1="\[\e[0;36m\]\\u\[\e[0;39m\]@\[\e[0;36m\]\\h\\W\[\e[m\]\\$ "

Much thanks.
 
Old 04-27-2014, 10:08 AM   #8
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,544

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
Please mark as SOLVED once you have a solution
 
Old 04-27-2014, 10:20 AM   #9
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
How is that done (Solved)? Can't get the search to work.
 
Old 04-27-2014, 11:34 AM   #10
battles
Member
 
Registered: Apr 2014
Distribution: Debian GNU/Linux 7.5 (wheezy)
Posts: 231

Original Poster
Rep: Reputation: 5
There it is :~. If it had been a snake, it would have bitten me.

"Please Mark this thread as solved if you feel a solution has been provided."
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing prompt in tcsh guyafe Red Hat 13 12-15-2010 02:58 AM
Changing the prompt? Ordinary12 Fedora 14 05-23-2007 10:05 PM
Changing the command Prompt Demon_Spawn Linux - Newbie 4 09-24-2006 09:09 PM
Changing the command prompt DJ KC Red Hat 3 10-10-2005 12:47 AM
changing prompt colors? microsoft/linux Debian 2 05-29-2005 04:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration