This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] base-files-4.0.6: Change prompt if running with admin rights


On 4/24/11 9:39 AM, Christian Franke wrote:
> On 2011-04-01, Christian Franke wrote:
>> The attached patch for /etc/profile and /etc/bash.bashrc sets a root
>> prompt ('#' instead of '$' or '%') if the shell runs with admin rights
>> (local or domain admin group).
>>
> 
> Any comment so far? Wrong list ?


I like the idea, but your patch adds two subprocess invocations to the
shell startup path. Each one takes ~200ms, and we can't afford to add
any more.

Instead of examining the group list, you can use something like

local isadmin=0
[[ -w / ]] && isadmin=1

or

local isadmin=0
[[ -w /cygdrive/c ]] && isadmin=1

Of course, that test assumes that only "administrators" can write to the
drive root, and that's an imperfect proxy for administrative rights. You
get the idea though: try to perform the test in pure bash code.

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]