|
|
|
10.5: Fix the sudo shell prompt
Unix convention in shell prompts is that the trailing character '$' is used for non-root users, and '#' for root (essentially).
10.5: Fix the sudo shell prompt
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 #.
10.5: Fix the sudo shell prompt
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
10.5: Fix the sudo shell prompt
My apologies, while you are correct, I was referring to the $ in the example SUDO_PS1 given. :)
The prompt shown does that
Try it.
The prompt shown does that
Don't have to, just realised I forgot about \$. I'll shut up now. :)
|
SearchFrom our Sponsor...What's New:HintsNo new hintsComments last 2 days
Links last 2 weeksNo recent new linksWhat's New in the Forums?
The Editor's Corner...Here are some of my (robg) other projects...
Hints by TopicNews from Macworld
The macosxhints PollWhat version of OS X are you running as your main OS?
Other polls | 11,537 votes | 42 comments
|
|
Copyright © 2009 Mac Publishing LLC (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Powered by Geeklog Created this page in 0.03 seconds |
|