From: Mark Wooding Date: Fri, 8 May 2020 22:45:11 +0000 (+0100) Subject: dot/shell-rc: Behave usefully in Cygwin elevated sessions. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/08785e51dfecd7f2ebc801df58971c787c33ae47 dot/shell-rc: Behave usefully in Cygwin elevated sessions. Decorate the prompt as if we're root -- which, really, we basically are -- and put a `%admin' marker in the window title. --- diff --git a/dot/shell-rc b/dot/shell-rc index 9857a82..7313cee 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -67,12 +67,26 @@ __mdw_hqual=$__mdw_hqual${SCHROOT_CHROOT_NAME+/$SCHROOT_CHROOT_NAME} __mdw_hqual=$__mdw_hqual${CROSS_BUILDENV+/$CROSS_BUILDENV} __mdw_set_prompt_hacks () { host=$__mdw_host; dir=""; } +__mdw_system=$(uname -s) : ${USER-${LOGNAME-$(id -un)}} __mdw_user=$USER case $(id -u) in - 0) __mdw_rootp=t ;; - *) __mdw_rootp=nil ;; + 0) + __mdw_rootp=t + ;; + *) + case $__mdw_system in + CYGWIN_*) + case " $(id -G) " in + *" 544 "*) __mdw_rootp=t __mdw_user="$__mdw_user%admin" ;; + *) __mdw_rootp=nil ;; + esac + ;; + *) + __mdw_rootp=nil + ;; + esac esac __mdw_set_prompt_pieces () {