X-Git-Url: https://git.distorted.org.uk/~mdw/profile/blobdiff_plain/81ba988cc2c9639b75bdacc97419811f56f3c335..77619173fdf73ef9835c877f6376bcfc25733c28:/dot/shell-rc diff --git a/dot/shell-rc b/dot/shell-rc index bec48d4..7313cee 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -67,7 +67,27 @@ __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 + ;; + *) + 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 () { @@ -81,15 +101,15 @@ __mdw_set_prompt_pieces () { ## highlight when I'm running as some other user. Highlight when this ## isn't the outermost shell on the terminal. local left right u tty - case $(id -u) in - 0) + case $__mdw_rootp in + t) left=$(echo « | iconv -f UTF-8 -t //translit) right=$(echo » | iconv -f UTF-8 -t //translit) ;; - *) + nil) case $USER in mdw | mwooding | nemo) u="" left="[" right="]" ;; - *) u="$USER@" left="{" right="}" ;; + *) u="$__mdw_user@" left="{" right="}" ;; esac tty=$(tty) case "$__mdw_tty" in @@ -149,7 +169,7 @@ __mdw_set_prompt () { __mdw_xterm_settitle () { printf >/dev/tty \ "]2;%s@%s:%s – %s\\" \ - "$USER" "$__mdw_host$__mdw_hqual" "$PWD" \ + "$__mdw_user" "$__mdw_host$__mdw_hqual" "$PWD" \ "$1" } __mdw_xterm_precmd () { __mdw_xterm_settitle "$__mdw_shell"; }