Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've customized the prompt in my Mac terminal like this:

export PS1="\[\e[31;1m\] \w $ \[\e[0m\] "

This way I get the /working/directory $ in bold red, but I also want to get the command I execute in bold red. Nonetheless, I want the output of the command to be of default color.

Basically I want this:

enter image description here

Any help, please?


EDIT: I tried the code on this answer but at least for me it is not working. It makes the command bold, but also the command output. And in fact I'm getting an extra ${OFF} tag printed after the command output and even a crazy behaviour when I press up key to see previous executed commands...

share|improve this question
    
Alright, I'm reopening the question and cleaning this comment thread up. Please add a reference to the question I linked to the question and state that it doesn't work (and explain in detail what does happen when you try it). Thanks! – Daniel Beck Mar 8 '14 at 23:08

Here's how to do it:

export PS1="\[\e[31;1m\] \w $ "   
trap 'echo -ne "\e[0m" ' DEBUG

All the magic comes from Different colors for text entry and console output.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .