chadgh
chadgh

Reputation: 9773

Making entered commands bold at the prompt

This is my current PS1 prompt definition from by .bashrc:

PS1='\[\033[01;33m\]★ \[\033[01;30m\]\w \[\033[32m\]\$ \[\033[m\]'

My command prompt works great and I love it, but I would like to add one more little thing. I would really like to be able to have the text I enter (commands at the prompt) bold.

I know I could change the last escape code to be:

\[\033[01m\]

Which would make the command prompt text I enter bold, but it also does funny (undesirable) things with the output of entered commands.

Is there a way to do this? If so, how?

I am running gnome-terminal in Ubuntu.

Upvotes: 1

Views: 3089

Answers (1)

echoack
echoack

Reputation: 126

I was looking to do this too. I found an answer here: https://wiki.archlinux.org/index.php/Color_Bash_Prompt#Different_colors_for_text_entry_and_console_output

Add this line to your ~/.bashrc which will reset the color that you set in your PS1 variable before displaying your command's output:

trap 'echo -ne "\e[0m"' DEBUG

Upvotes: 6

Related Questions