-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmkmandir.sh
executable file
·47 lines (37 loc) · 894 Bytes
/
mkmandir.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash -e
# create man page dir for non-globally installed
# programes
shopt -s nullglob
# setting up a man-dir in ~/man
::() {
echo -e "\e[0;31m:: \e[0;32m$*\e[0m"
}
MANDIR=$HOME/man
for d in "$MANDIR" "$MANDIR"/man{0..8} ; do
:: Creating "$d"
mkdir -p "$d"
done
searchdir=(
~/git/herbstluftwm/build/doc/
~/git/qutebrowser/doc/
~/git/rofi/doc/
~/git/katarakt/doc/
~/git/git-remote-hg/doc/
~/git/plaur/
)
for d in "${searchdir[@]}" ; do
:: Searching for man pages in "$d"
for f in "${d%/}"/*.[0-8] ; do
section="${f##*.}"
target="${MANDIR}/man$section"
:: Linking "${target##${MANDIR%/}/}/ <- ${f#$d}"
ln -sf "$f" "$target"
done
done
cat <<EOF
# Add the following to your bash configuration:
# extend man-variable
if [ -d "\${HOME}/man" ] ; then
export MANPATH="\${HOME}/man:\${MANPATH}"
fi
EOF