Last active
August 23, 2017 12:01
-
-
Save GKFX/c5936378cf0c15a309afde4f10296052 to your computer and use it in GitHub Desktop.
Interactive apropos bash function
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
# I, the copyright holder of this work, release this work into the public domain. This applies worldwide. | |
# In some countries this may not be legally possible; if so: | |
# I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law. | |
apropos() { | |
/usr/bin/apropos "${@}" |\ | |
sed -n 's/\(\S*\) (\([^)]\))\s*- \(.*\)/\1 (\2)\c@\3\x00/p' |\ | |
tr -d '\n' |\ | |
xargs -0 whiptail --ok-button "Open" --output-fd 3 --title "apropos ${*}" --menu "Choose a man page." 25 100 16 -- 3>&1 1>&2 2>/dev/null |\ | |
sed -n 's/^\(\S*\) (\([^)]\))$/\2 \1/p' |\ | |
xargs -r man | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment