ambevar-dotfiles/.scripts/bsdman

27 lines
488 B
Bash
Executable File

#!/bin/sh
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
cat<<EOF
Usage: ${0##*/} [SECTION] PAGE
Fetch FreeBSD man page PAGE from the official website and display it.
EOF
exit
fi
SECTION=0
PAGE=$1
if [ $# -eq 2 ]; then
SECTION="$1"
PAGE="$2"
fi
AGENT="curl -s"
if ! command -v curl >/dev/null; then
AGENT="wget -q -O - "
fi
$AGENT "http://www.freebsd.org/cgi/man.cgi?query=$PAGE&apropos=0&sektion=$SECTION&manpath=FreeBSD+10-current&arch=default&format=ascii" | less