ambevar-dotfiles/.scripts/bsdman

27 lines
493 B
Plaintext
Raw Normal View History

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