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.

My prompt is:

PS1="\`if [ \$? = 0 ]; then echo \[\e[33m\]':)'\[\e[0m\]; else echo \[\e[31m\]':('\[\e[0m\]; fi\` \e[0;1m\w\e[1m\n\$ "

The problem is when I use ls, the prompt changes colors to the color of the last line outputted with ls. For example, if I have a file named z, the prompt changes to grey (to match the color of files from ls) after typing ls, and this behavior is driving me nuts.

Anyone know how I can fix that? I want the entire prompt set to white, with the smilies colored differently.

(My prompt spits out a :) or a :( based on the outcome fo the last command, shows the directory path of pwd, then drops to a new line for command input)

I've enabled force_color_prompt to no avail.

share|improve this question
    
Are you open to resetting your prompt entirely, or is that not an option? –  InkBlend Feb 18 '13 at 5:10
    
That depends I suppose. Is there something in the functionality of my prompt that's causing the issue? I didn't have this problem before on my universities open suse server since ls had no colorize option there, so I assume it's ls colorize that's causing the problem. –  Dirgon Feb 18 '13 at 15:21
add comment

1 Answer

Solved it.

New prompt (with \u@\h added, since I forgot that) is

export PS1="\e[0;1m\u@\h]\`if [ \$? = 0 ]; then echo \[\e[33m\]':)'\[\e[0m\]; else echo \[\e[31m\]':('\[\e[0m\]; fi\` \e[0;1m\w\e[1m\n\$ "

adding the e[0;1m\ at the very beginning of the prompt began the colorizing of the prompt. Can't believe I overlooked that.

Essentially the prompt changed colors because the terminal changed from the previous color ouputted by ls. I thought that was the problem before but couldn't figure out the syntax needed to colorize the first bit.

share|improve this answer
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.