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: [PATCH] base-files-4.2-1: Change prompt if running with admin rights


Thomas Wolff wrote:
I use this in .bashrc (to embed $rootmark in an ESC sequence in PS1 later). I think it doesn't have specific dependencies and also it's portable (except the group names are Windows ones...).

It's not portable because Windows default user/group names are localized.


  if id | grep -e "gid=.*(root)" -e "gid=.*(Administrators)" > /dev/null
  then    rootmark="30;41"; dirmark=7
  elif id | grep -e "gid=.*(Power Users)" > /dev/null

German Windows uses "Administratoren", "Hauptbenutzer", "Domänen-Admins', ...


  then    rootmark="30;43"; dirmark=7
  else    rootmark=0; dirmark="33;44"
  fi

Also I embed [$SHLVL] in PS1 unless it's 0, just as a suggestion.

Makes sense. I vote +1 for the base-file's /etc/bash.bashrc :-)

Christian


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