Last active
October 23, 2016 19:03
-
-
Save marek-saji/e87c7d78cb62e19c02ae4b12ff85a025 to your computer and use it in GitHub Desktop.
man(1) wrapper that tries running a command with --help if no man page found
This file contains hidden or 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
# If no man page found, try running the command with --help | |
man () | |
{ | |
if man -w "$1" >/dev/null 2>&1 | |
then | |
command man "$@" | |
elif which "$1" >/dev/null | |
then | |
echo "No man page found for $1, trying --help..." | |
"$1" --help 2>&1 | less -S | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment