Skip to content

Commit f5c1089

Browse files
committed
.rc: Don't risk error on unset MANPATH
In the `.rc` initialization script, when mutating the `MANPATH` variable such as to make our man-page discoverable via it, rather than unconditionally attempting to substitute the old value of `MANPATH` into its new value, instead substitute it only if it is set. The purpose of this change is to avoid raising an error if -- - attempting plain (unconditional) parameter expansion of an unset parameter is considered an error by the shell, as it may be due to shell options that the user may have set, or perhaps due to what shell the user may be using; and - `MANPATH` is unset, as it may well be (it's unset by default on my desktop and laptop computers (both running NixOS), an Arch Linux VPS I use, and, I'm told, on Ubuntu and FreeBSD). I note that leaving a colon at the end of the value of `MANPATH` appears to be necessary for man-pages installed at the OS level to still be discoverable if `MANPATH` is normally unset.
1 parent 94cf6aa commit f5c1089

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.rc

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
export GIT_HUB_ROOT="$(cd "$(dirname $GIT_HUB_ROOT)"; pwd)"
2222

2323
export PATH="$GIT_HUB_ROOT/lib:$PATH"
24-
export MANPATH="$GIT_HUB_ROOT/man:$MANPATH"
24+
export MANPATH="$GIT_HUB_ROOT/man:${MANPATH-}"
25+
2526
source "$GIT_HUB_ROOT/share/enable-completion.sh"

0 commit comments

Comments
 (0)