Last active
March 12, 2022 20:59
-
-
Save april/708215a49c9ad970262dc605a0595d5d to your computer and use it in GitHub Desktop.
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
| mansplain() { | |
| user=`echo $USER | tr "[:lower:]" "[:upper:]"` | |
| # ugh, macos vs linux | |
| if command -v gzcat | |
| then | |
| _cat() { gzcat $@; } | |
| else | |
| _cat() { zcat $@; } | |
| fi | |
| # set pager if not set | |
| if [ -z ${PAGER+x} ]; then PAGER=less; fi | |
| _cat --force `man -w $1` | sed -E -e "s/\.SH \"?NAME\"?/.SH \"WELL ACTUALLY, $user, LET ME EXPLAIN...\"/" | groff -man -Tutf8 | $PAGER | |
| } |
Author
Fixed, added a lot of armor to make it cross platform.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know about other distros, but on Ubuntu manpages are zipped, so you need
zcatinstead ofcat.