I want the terminal to highlight the current bash prompt line.
The effect I'm trying to acheive is the same as in text editors where the current line with the cursor is highlighted.
Something like this:
Bash – Highlight current bash prompt line
bashprompt
Best Answer
If you're happy with highlighting only the prompt, then the following will apply reverse colors on whatever you have already in
PS1
:If you have a space at the end of the prompt (this is common practice) that you don't want to highlight:
Some terminals, at least iTerm for macOS, have the option to set a "cursor guide". This is probably doing exactly what you want to achieve (I have exaggerated the guide in the picture, I usually have it much more transparent, and red, as in the second picture):
The cursor guide has nothing to do with the shell and will be always be displayed, regardless of what you're doing (very faint red cursor guide on the line reading
AC_CONF_AUX_DIR([build])
, here shown in thevim
editor):Unfortunately I only run iTerm on macOS, so I don't know if there are terminal emulators out there that can do this for your particular Unix.