This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH] base-files-4.2-1: Change prompt if running with admin rights
- From: Thomas Wolff <towo at towo dot net>
- To: cygwin at cygwin dot com
- Date: Fri, 11 Apr 2014 09:20:21 +0200
- Subject: Re: [PATCH] base-files-4.2-1: Change prompt if running with admin rights
- Authentication-results: sourceware.org; auth=none
- References: <53458036 dot 1010307 at t-online dot de> <877g6ys69r dot fsf at Rainer dot invalid> <1187249515 dot 20140410053930 at yandex dot ru>
Am 10.04.2014 03:39, schrieb Andrey Repin:
Greetings, Achim Gratz!
Christian Franke writes:
Attached is an updated version of:
I'll put this on hold until the AD integration has landed in Cygwin
(which will require some larger changes anyway).
Generally I'd prefer to move such things that depend on personal
preferences like setting up prompts into profile.d where they are easier
to change and maintain independently from core system functionality.
Using the registry to check for administrative privileges is clever,
It does not guarantee, that a user have administrator rights, only that it has
access to the specified registry key.
however I'm wondering why we shouldn't simply check via id (that's what
I'm doing personally at the moment).
Unless there's a way to ask "if we're a part of <certain group>" or more
direct questions, it would involve much tinkering.
And I agree, that all tinkering needs to go into personal profile.
I use this in .bashrc (to embed $rootmark in an ESC sequence in PS1 later).
I think it doesn't have specific dependencies and also it's portable
(except the group names are Windows ones...).
if id | grep -e "gid=.*(root)" -e "gid=.*(Administrators)" > /dev/null
then rootmark="30;41"; dirmark=7
elif id | grep -e "gid=.*(Power Users)" > /dev/null
then rootmark="30;43"; dirmark=7
else rootmark=0; dirmark="33;44"
Also I embed [$SHLVL] in PS1 unless it's 0, just as a suggestion.
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple