LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-08-2010, 03:32 AM   #1
Andramalech
Member
 
Registered: Nov 2004
Location: Sweden
Distribution: SUSE 11.2
Posts: 52

Rep: Reputation: 15
Tiny but annoying problem regarding PS1 prompt appearance after tweaking


Hi,

I often have long outputs to the terminal and to make my life easier I have decided to tweak the prompt to appear bold with the export line below:
Code:
export PS1='\033[1m\u@`hostname`:\w>\033[0m '
This seemed to do the trick, the prompt is bold indeed.. However if a command line is long, especially if one browses between old commands with the up and down keys the appearance of the prompt line gets screwed. Below is an example where a long line writes over the prompt instead of a new line.

Code:
ufuk@office2:~/Documents/OWL tools/chibe> ^C
BIOPAX.owl 2:~/Documents/OWL tools/chibe> ./ChiBE.sh ~/Documents/Test\ files/CPATH-580499-B

Any idea what the problem might be?
 
Old 04-08-2010, 09:30 AM   #2
Vrajgh
Member
 
Registered: Aug 2005
Posts: 68

Rep: Reputation: 33
It is a good idea to wrap non printing characters between \[ and \] so that the shell is able to calculate the length of the prompt and hence wrap the lines correctly.

Code:
export PS1='\[\033[1m\]\u@`hostname`:\w>\[\033[0m\] '

Last edited by Vrajgh; 04-08-2010 at 09:32 AM.
 
  


Reply



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
Prompt not hard returning after PS1 variable change? SlowCoder Linux - Newbie 5 05-01-2007 09:16 PM
Post your BASH prompt [PS1]? introuble General 11 12-27-2006 03:47 PM
$PS1 different in X and prompt codec Slackware 7 06-27-2004 04:42 PM
Change appearance of command prompt Irving Linux - Software 2 06-09-2004 10:30 PM
Please Help: Very Tiny Appearance - FreeBSD rvijay *BSD 8 09-13-2003 04:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:02 PM.

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
Open Source Consulting | Domain Registration