1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/bin/sh # TODO: -s flag to apropos page="$(apropos . \ | sed -E 's/ (\([^)]+\))\s*-/\1 —/' \ | sort \ | osel \ | sed 's/\s.*//')" if [ -n "$page" -a ! -t 2 ] then man -Tpdf "$page" | zathura - elif [ -n "$page" -a -t 2 ] then man "$page" fi