Thanks to Achim Gratz for adopting base-files. Attached is an updated version of: https://sourceware.org/ml/cygwin/2012-02/msg00806.html
Christian
diff -rup base-files-4.2-1.orig/etc/defaults/etc/bash.bashrc base-files-4.2-1/etc/defaults/etc/bash.bashrc --- base-files-4.2-1.orig/etc/defaults/etc/bash.bashrc 2014-03-23 14:56:28.412930900 +0100 +++ base-files-4.2-1/etc/defaults/etc/bash.bashrc 2014-04-09 13:42:05.000000000 +0200 @@ -27,7 +27,7 @@ export EXECIGNORE="*.dll" # Set a default prompt of: user@host and current_directory -PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' +PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n'"${PS1a:-\\\$ }" # Uncomment to use the terminal colours set in DIR_COLORS # eval "$(dircolors -b /etc/DIR_COLORS)" diff -rup base-files-4.2-1.orig/etc/defaults/etc/profile base-files-4.2-1/etc/defaults/etc/profile --- base-files-4.2-1.orig/etc/defaults/etc/profile 2014-03-23 14:56:28.312931800 +0100 +++ base-files-4.2-1/etc/defaults/etc/profile 2014-04-09 12:59:43.000000000 +0200 @@ -109,6 +109,12 @@ else cd "${HOME}" || echo "WARNING: Failed attempt to cd into ${HOME}!" fi +# Set PS1a if user has admin rights +unset PS1a +if [ -r /proc/registry/HKEY_LOCAL_MACHINE/SECURITY ]; then + PS1a="# " +fi + # Shell dependent settings profile_d () { @@ -135,15 +141,17 @@ if [ ! "x${BASH_VERSION}" = "x" ]; then [ -f "/etc/bash.bashrc" ] && . "/etc/bash.bashrc" elif [ ! "x${KSH_VERSION}" = "x" ]; then typeset -l HOSTNAME="$(/usr/bin/hostname)" - [ "${PS1-null}" = "null" ] || PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n$ ') + [ "${PS1-null}" = "null" ] || PS1=$(print '\033]0;${PWD}\n\033[32m${USER}@${HOSTNAME} \033[33m${PWD/${HOME}/~}\033[0m\n'"${PS1a:-\$ }") elif [ ! "x${ZSH_VERSION}" = "x" ]; then # zsh is in shell compatibility mode here, so we probably shouldn't do this profile_d zsh + [ "${PS1-null}" = "null" ] || PS1='(%n@%m)[%h] %~ '"${PS1a:-%% }" elif [ ! "x${POSH_VERSION}" = "x" ]; then - : # [ "${PS1-null}" = "null" ] || PS1="$ " + : # [ "${PS1-null}" = "null" ] || PS1="${PS1a:-\$ }" else - : # [ "${PS1-null}" = "null" ] || PS1="$ " + : # [ "${PS1-null}" = "null" ] || PS1="${PS1a:-\$ }" fi +unset PS1a export PROFILEREAD PATH ORIGINAL_PATH MANPATH INFOPATH USER TMP TEMP PRINTER HOSTNAME PS1 SHELL tmp temp
-- 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