Change PS1 when run as administrator

Achim Gratz Stromeko@nexgo.de
Tue Mar 15 18:38:00 GMT 2016


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



More information about the Cygwin mailing list