Skip to content

Instantly share code, notes, and snippets.

@ccjoel
Created February 23, 2017 20:57
Show Gist options
  • Save ccjoel/a9acc47218c3cf6bb0ca6fa096d3c9a9 to your computer and use it in GitHub Desktop.
Save ccjoel/a9acc47218c3cf6bb0ca6fa096d3c9a9 to your computer and use it in GitHub Desktop.
Manpages fallback quick demo
# Curl online manpages and pipe to less
webman () {
curl http://man.he.net/\?topic\=$1\&section\=all | less
}
# Calls man pages or fallbacks to webman
man()
{
echo "Fetching man page for $1 ..."
res=$(/usr/bin/man $1);
code=$?;
if [ "$code" -eq "0" ];then
echo $res | less;
else
echo "No man page found on system, using webman:";
webman $1;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment