+Fix $USER and $LOGNAME (not $MAIL) for /etc/passwd "root-..." lines.
authorshort <>
Sat, 6 Aug 2005 23:29:14 +0000 (23:29 +0000)
committershort <>
Sat, 6 Aug 2005 23:29:14 +0000 (23:29 +0000)
.bashrc

diff --git a/.bashrc b/.bashrc
index b4bce39..2141644 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -21,6 +21,13 @@ if [ -z "$_home_short_dotbashrc" ];then
        # alias norc='TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;"'
        function norc { TERM="norc-$TERM" ssh -t -o 'NoHostAuthenticationForLocalhost yes' $USER@localhost "cd $PWD; TERM=$TERM;" "$@"; }; export -f norc
 
+# Fix $USER and $LOGNAME (not $MAIL) for /etc/passwd line:
+# root-lace:x:0:0:root for Jan Kratochvil:/home/root-lace:/bin/bash
+if [ "$UID" -eq 0 -a "$USER" = "root" -a "$HOME" != "${HOME#*/root-}" ];then
+       USER="${HOME##*/}"
+       LOGNAME="$USER"
+fi
+
 if [ -f /etc/bashrc ];then source /etc/bashrc;fi
 
 function _bash_profile_addpath # <variablename>,<dirpathname>