3

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...

MikO
  • 1,505

1 Answers1

1

Here's how to do it:

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

All the magic comes from Escapes between command input and output .

wjandrea
  • 686
lemonsqueeze
  • 1,330