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 running as administrator


Hi,

I recently bought a new home computer, so I switched from XP to Win81.
With Win81 every now and then I need to start cygwin as administrator
(right click shortcut or tile, run as administrator) to do things that
I can't do as a normal user.

When I run as administrator I change my PS1 from "$" to "#" with these
line in ~/.bashrc.

if id -Gn | grep -i Administrators > /dev/null
then
    PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n# '
else
    PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
fi

I don't know if the test can be done a better/easier way, but it works
for me on a Dutch Win81. I tested it with both 1.7.30 and a recent
AD/SAM snapshot.

If more people like this idea, maybe it could included in /etc/bash.bashrc?

Regards,
Frank

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