Created
February 23, 2017 20:57
-
-
Save ccjoel/a9acc47218c3cf6bb0ca6fa096d3c9a9 to your computer and use it in GitHub Desktop.
Manpages fallback quick demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Curl online manpages and pipe to less | |
webman () { | |
curl http://man.he.net/\?topic\=$1\§ion\=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