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: Change PS1 when run as administrator


Warren Young writes:
> Iâm not certain the string match on the output of id(1) works
> everywhere.  Is there a better way to check for admin privileges under
> Cygwin?  You canât check for UID or EUID == 0, for example, as youâd
> do on a true POSIX system.

{ id -G | grep -Eq '^544$'; } && echo admin || echo nope

> Perhaps something like this should go into the default /etc/profile?

No, since it gets read for all shells, not just interactive ones.  The
only reason the prompt is set at all in /etc/profile on Cygwin is that
there is no init/login process to initialize it.  But you can always
place a script to that effect into /etc/profile.d if you absolutely want
it there anyway.  I think putting these in the ENV file is preferrable.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf microQ V2.22R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

--
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


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