From 7db5ad342b819ef150c3caf661bdad38de3120cd Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 2 Aug 2015 18:55:13 +0300 Subject: [PATCH] .shellrc: reset HOME if /home is a symlink On BSD /home is a symlink to /usr/home. --- .shellrc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.shellrc b/.shellrc index 67f9b76..85ca29e 100644 --- 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 -- 2.39.2