about summary refs log tree commit diff
path: root/profile/.profile.d/30_manpath.sh
blob: af4273e569d5d01a08f01652ab4258dea86933db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh

manpath_append() {
	[ ! -d "${1}" ] && return
	echo "${MANPATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return
	export MANPATH="${MANPATH}:${1}"
}

manpath_prepend() {
	[ ! -d "${1}" ] && return
	echo "${MANPATH}" | grep -q "\(:\|^\)${1}\(:\|$\)" && return
	export MANPATH="${1}:${MANPATH}"
}

manpath_prepend "/usr/share/man"
manpath_prepend "/usr/local/share/man"
manpath_prepend "${HOME}/.local/share/man"

Consider giving Nix/NixOS a try! <3