Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Fix the sudo shell prompt' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Fix the sudo shell prompt
Authored by: corienti on Mar 19, '08 05:58:29PM

Yes, it certainly has. Very long standing custom.

However in these modern times, I always use a colour prompt, and have it so the username comes up in red if root, and another colour if not root.
I find the red is far more visible and noticeable than the #.



[ Reply to This | # ]
10.5: Fix the sudo shell prompt
Authored by: corienti on Mar 19, '08 06:02:30PM

For what it's worth, this is what I use. Customise colours to preference.
(note colours range from 31 to 36, and 01 and 00 indicate bold/nonbold.


if [ "${USER}" = "root" ]; then
USER_COL="01;31"; PATH_COL="01;33"
else
USER_COL="01;33"; PATH_COL="01;32"
fi
HOST_COL="01;37"
export PS1="\n\[\e[${USER_COL}m\]\u @ \[\e[${HOST_COL}m\]\h > \[\e[${PATH_COL}m\]\w/\[\e[0;38m\]\n-> "
unset HOST_COL PATH_COL USER_COL



[ Reply to This | # ]
10.5: Fix the sudo shell prompt
Authored by: mjb on Mar 19, '08 07:37:02PM

My apologies, while you are correct, I was referring to the $ in the example SUDO_PS1 given. :)



[ Reply to This | # ]