.bashrc: Make sure $MANPATH has some sane defaults
authorTony Duckles <tony@nynim.org>
Sun, 4 Feb 2018 22:13:11 +0000
committerTony Duckles <tony@nynim.org>
Sun, 4 Feb 2018 22:13:11 +0000
.bashrc

diff --git a/.bashrc b/.bashrc
index 05101353b07729b07412d26af73dd41e487050da..a8ca5588198cb523b44c5ccf0251b07a5047b305 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -65,6 +65,10 @@ umask 0022
 # PATH
 # ----------------------------------------------------------------------
 
+# make sure $MANPATH has some sane defaults
+: ${MANPATH="/usr/share/man"}
+test -d "/usr/share/man" && MANPATH="/usr/share/man:$MANPATH"
+
 # include the various sbin's along with /usr/local/bin
 PATH="$PATH:/usr/local/sbin:/usr/sbin:/sbin"
 PATH="/usr/local/bin:$PATH"
@@ -75,12 +79,16 @@ test -d "$HOME/sbin" && PATH="$HOME/sbin:$PATH"
 
 # SmartOS pkgin
 test -d "/opt/local" && PATH="/opt/local/sbin:/opt/local/bin:$PATH"
+test -d "/opt/local/man" && MANPATH="/opt/local/man:$MANPATH"
 # SmartOS local files
 test -d "/opt/custom" && PATH="/opt/custom/sbin:/opt/custom/bin:$PATH"
+test -d "/opt/custom/man" && MANPATH="/opt/custom/man:$MANPATH"
 # SmartOS SDC
 test -d "/smartdc" && PATH="/smartdc/bin:/opt/smartdc/bin:/opt/smartdc/agents/bin:$PATH"
+test -d "/smartdc/man" && MANPATH="/smartdc/man:$MANPATH"
 # SmartOS native binaries, for OS/LX zones
 test -d "/native" && PATH="$PATH:/native/usr/sbin:/native/usr/bin:/native/sbin:/native/bin"
+test -d "/native/usr/share/man" && MANPATH="$MANPATH:/native/usr/share/man"
 
 # RVM
 test -d "$HOME/.rvm/bin" && PATH="$PATH:$HOME/.rvm/bin"
@@ -238,9 +246,6 @@ if [ "$UNAME" = SunOS ]; then
     test -x /usr/gnu/bin/grep && alias grep="/usr/gnu/bin/grep"
     test -x /usr/gnu/bin/sed  && alias sed="/usr/gnu/bin/sed"
     test -x /usr/gnu/bin/awk  && alias awk="/usr/gnu/bin/awk"
-
-    # setup MANPATH
-    MANPATH="/usr/share/man:/smartdc/man:/opt/smartdc/man:/opt/local/man:/opt/custom/man:$MANPATH"
 fi
 
 # ----------------------------------------------------------------------