]> git.phdru.name Git - dotfiles.git/commitdiff
.shellrc: reset HOME if /home is a symlink
authorOleg Broytman <phd@phdru.name>
Sun, 2 Aug 2015 15:55:13 +0000 (18:55 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 2 Aug 2015 15:55:13 +0000 (18:55 +0300)
On BSD /home is a symlink to /usr/home.

.shellrc

index 67f9b762c91d7388eb23e8b99aa270b0996ec9dd..85ca29e03d700b4abaa0db0b38288077388c9aac 100644 (file)
--- a/.shellrc
+++ b/.shellrc
@@ -6,6 +6,18 @@ OPS1="$OPS1\\$"
 PS1="$OPS1 "
 
 
+case "$HOME" in
+   /home/*)
+      home_link="`readlink /home`"
+      if [ -n "$home_link" ]; then
+         START_DIR="`pwd`" &&
+         cd "$HOME" &&
+         HOME="`pwd`" &&
+         cd "$START_DIR"
+      fi
+   ;;
+esac
+
 case "$SHELL" in
 */bash)
    [ "`type -t ls`" = alias ] && unalias ls