Change PS1 when run as administrator

Warren Young
Tue Mar 15 22:30:00 GMT 2016

On Mar 15, 2016, at 3:34 PM, Thomas Wolff <> wrote:
> Is there also a universal replacement for
>    elif id | grep -e "gid=.*(Power Users)" > /dev/null
> ?

Give this a try:

for group in $(id -G); do
   test $group -eq 544 && { PS1_PCHAR='#'; PS1_COLOR=31; break; }
   test $group -eq 547 && { PS1_PCHAR='>'; PS1_COLOR=36; break; }
   test $group -eq 0   && { PS1_PCHAR='!'; PS1_COLOR=41; break; }
PS1='\[\e]0;\w\a\]\n\[\e['$PS1_COLOR'm\]\u@\h '
PS1=$PS1'\[\e[33m\]\w\[\e[0m\]\n'$PS1_PCHAR' '

I chose the color and prompt character mnemonically from PowerShell.

The color is actually cyan rather than the true blue of PowerShell because blue-on-black is difficult for me to read.  (Chromatic aberration due to glasses.)

This is untested since the Power Users group seems to have disappeared in Windows 10.
Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list