From: Mark Wooding Date: Tue, 8 Aug 2017 22:59:02 +0000 (+0100) Subject: dot/shell-rc: Get user name from id(1) if it's not in the environment. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/2ab4329692381a068a0264fea3b93143fb376eea?ds=sidebyside dot/shell-rc: Get user name from id(1) if it's not in the environment. --- diff --git a/dot/shell-rc b/dot/shell-rc index 11b9fc7..ac8819d 100644 --- a/dot/shell-rc +++ b/dot/shell-rc @@ -37,7 +37,7 @@ __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 user u tty - user=${USER-$LOGNAME} + user=${USER-${LOGNAME-$(id -un)}} case $(id -u) in 0) left=$(echo « | iconv -f UTF-8 -t //translit)