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]

Change PS1 when run as administrator


I just came up with this recipe to change the default PS1 value to use red for the user@host part of the prompt and to change the $ character to a #:

    if id | grep -qi 'member of administrators group'
    then
        export PS1=$(echo "$PS1" | sed -e 's_32_31_' -e 's_\\\$_#_')
    fi

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.

Perhaps something like this should go into the default /etc/profile?
--
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]