Skip to content

Instantly share code, notes, and snippets.

@andyxning
Created June 9, 2020 10:17
Show Gist options
  • Save andyxning/5cc1c368f2610aa131bb6b9fc47f094b to your computer and use it in GitHub Desktop.
Save andyxning/5cc1c368f2610aa131bb6b9fc47f094b to your computer and use it in GitHub Desktop.
Add linux man page docset to Dash
#!/bin/bash
# Under instructions in: https://blog.kapeli.com/linux-man-pages-in-dash
set -x
set -e
man_path_dest_dir="/usr/local/share/man"
man_pages_version="5.06"
linux_man_pages_download_link="https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/man-pages-${man_pages_version}.tar.xz"
wget -nv ${linux_man_pages_download_link} -O /tmp/man-pages-${man_pages_version}.tar.xz
if [ $? -ne 0 ]; then
echo "Download man pages ${man_pages_version} error"
exit 1
fi
tar xvf /tmp/man-pages-${man_pages_version}.tar.xz -C /tmp
if [ $? -ne 0 ]; then
echo "Extract man pages ${man_pages_version} error"
exit 1
fi
cd /tmp/man-pages-${man_pages_version}
for i in {1..7}; do
cd man$i
if [ ! -d ${man_path_dest_dir}/man$i ]; then
mkdir ${man_path_dest_dir}/man$i
fi
for item in *
do
mv $item ${man_path_dest_dir}/man$i/linux_$item
done
cd ../
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment