[colug-432] colug-432 Digest, Vol 28, Issue 25

Rob Funk rfunk at funknet.net
Fri Dec 30 12:46:28 EST 2011

On Friday, December 30, 2011 12:26:43 PM Mark Geary wrote:
> On Thu, 29 Dec 2011, Rob Funk <rfunk at funknet.net> wrote:
> > So a simplified version of my prompt setting is:
> > PS1="\[`tput smso`\]\h \@\[`tput rmso`\] \w\[`tput smul`\]\[`tput
> > rmul`\]\\$ "
> What is the purpose of the second half (after the "\w")?

Heh, good question..... and the answer isn't very good....

I'll start with the end, which actually makes sense: \\$ turns into '$' if the
current user ID is non-root, and turns into '#' if the current user ID is

The rest is kinda useless in the above context.
"tput smul" starts underline mode.
"tput rmul" ends underline mode.
And the prompt string I gave doesn't have anything in between, which means
those codes don't really do anything.

Why do I have useless codes in my prompt? Well, my real prompt calls some
shell functions in between them, to show me information about any git or
subversion project I might currently be in. When I deleted those calls for the
example, I forgot to delete the underlining codes around them.
PS1="\[`tput smso`\]\h \@\[`tput rmso`\] \w\[`tput smul`\]\$(parse_git_branch)\$(parse_svn_revision)\[`tput 
rmul`\]\\$ "

More information about the colug-432 mailing list