prompt w/ uid 0 for cshrc

Eitan Adler lists at eitanadler.com
Sun Nov 18 23:32:52 UTC 2012


Hey,

at the moment the current default csh prompt looks like

user at hostname:directory% command

This leads to an unexpected[*] result when using su (without "-").

In particular the user part is *not* changed to "root" (or "toor" or
any other superuser indication) although the promptchar is changed to
"#".
This causes some confusion for new users and even some experienced ones.

I worked around this issue by including the following

        if ($uid == 0) then
                set user = root
        endif

which I'm not certain is a good idea.

I would like to replace this with logic like

if $uid = 0 AND $user != toor AND $user != root
  set user = "+$user"
endif

does anyone think this is a bad idea? can anyone propose a better
idea? Is the status quo okay?

I don't trust user education for this problem. I've seen way too many
people get confused to leave the default without some extra indicator.

[*] Okay, so this is expected if you understand the difference between
"su" and "su -" but the defaults are not aimed at people that
understand this difference.


-- 
Eitan Adler


More information about the freebsd-current mailing list