Am 10.04.2014 03:39, schrieb Andrey Repin:
Greetings, Achim Gratz!
Christian Franke writes:
Attached is an updated version of:
https://sourceware.org/ml/cygwin/2012-02/msg00806.html
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,
But indirect.
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"
fi
Also I embed [$SHLVL] in PS1 unless it's 0, just as a suggestion.
------
Thomas
---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz
ist aktiv.
http://www.avast.com
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple